This article provides a brief note on the RabbitMq setup

The role of MQ (Message Que)

  1. Asynchronous: Improves service response speed.
  2. Decoupling: Moving logical processing to queues. When the consumption logic is modified, only the Consumer is changed, not the Producer
  3. Automatic compensation and retry: MQ automatically retries sending messages after a consumption failure.
  4. Guaranteed consumption order: The queue itself is a first-in, first-out (FIFO) feature that can consume messages based on the order in which they enter the queue
  5. Peak clipping: This is similar to asynchrony, except that it is designed to reduce the amount of concurrency that the consumer is experiencing at any given moment

RabbitMQ, Kafka, RocketMQ, etc.

Refer to the following article: Messaging-middleware deployment and comparison: rabbitMQ, activeMQ, zeroMQ, rocketMQ, Kafka, Redis

The main advantages of RabbitMQ:

  1. The erLang language naturally supports high concurrency
  2. MQ environment is relatively easy to set up
  3. There is a good message confirmation mechanism and message persistence
  4. Highly customizable routing policies
  5. Page management is convenient, high community activity

The RabbitMQ of actual combat

Install RabbitMQ in CentOS7

Official documentation for installation and use in various environments

  1. Install Erlang environment wget HTTP: / / https://github.com/rabbitmq/erlang-rpm/releases/download/v22.2/erlang-22.2-1.el7.x86_64.rpm Download the latest Erlang package, the current version is 22.2, because the latest version of RabbitMQ is 3.8.1. # yum install wget yum install wget # yum install wget

  2. Download the RPM package for rabbitMQ (CentOS7, if CentOS8, Change el7 in connection to EL8) wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.1/rabbitmq-server-3.8.1-1.el7.noarch.rpm

  3. Install rabbitmq-server-3.8.1-1.el7.noarch. RPM yum install rabbitmq-server-3.8.1-1.el7.noarch. RPM

  4. Start RabbitMQ chkconfig rabbitmq-server on /sbin/service rabbitmq-server start /sbin/service Rabbitmq-server stop /bin/systemctl start rabbitmq-server.service The rabbitmq – server. # service shut down

  5. Rabbitmqctl list_users rabbitmqctl list_users rabbitmq-plugins enable rabbitmq_management rabbitmqctl list_users

    [root@c5 ~]# rabbitmqctl list_users
    Listing users ...
    user    tags
    guest   [administrator]
    Copy the code

    So we need to manually add a user, Rabbitmqctl add_user admin 123456 rabbitmqctl set_user_tags admin administrator # set permissions

    Then you can log in using the admin account

P: Port number function

Conclusion:

  1. ErLang version problems during installation
  2. UI and port issues
  3. Login user and permission assignment problems

problems

  1. The user interface (UI) has been rejected for port 15672 (default queue: port 5672, UI: port 15672). The user interface (UI) has been rejected for port 15672

    Solutions:This is because the current UI plug-in has not been started, just run the following command.Rabbitmq-plugins enable rabbitmq_management

  2. The guest account has access restrictions.

    Solutions:You need to manually create an account for him. Then we need to manually add a user, and set the user permissions to AdministratorRabbitmqctl add_user admin 123456 Rabbitmqctl set_user_tags admin administrator # Set permission

Then you can log in using the admin account