RabbitMQ is a popular open source Message Queuing system. It is a standard implementation of the Advanced Message Queuing Protocol (AMQP) and is developed in the Erlang language. RabbitMQ is said to have high performance and timelay. it also supports cluster and load deployments, making it ideal for large scale distributed systems. RabbitMQ has been installed and configured for the project, and the server operating system is CentOS7.

V Basic knowledge

What is a Message Queue?

The Message (the Message)

Data transmitted between two computers or two communication devices in a network. For example: text, music, video and other content.

Queue (Queue)

A special linear table (data elements end to end) that allows only deleting elements at the head and appending elements at the tail. In and out of the team.

Message Queue (MQ)

Message + queue, the queue that holds messages. The container in which messages are transmitted; It mainly provides production and consumption interfaces for external calls to store and obtain data.

MQ classification

There are two main types of MQ: peer-to-peer (P2P) and publish-subscribe (Pub/Sub)

Thing in common:

Message producers produce messages to send to the queue, and message consumers read and consume messages from the queue.

Difference:

P2p model includes Queue, Sender and Receiver.

A message produced by a producer has only one Consumer (that is, once consumed, the message is not in the message queue). Like making phone calls.

Pub/Sub contains: message Queue, Topic, Publisher, Subscriber. Each message can have multiple consumers, with no influence on each other. For example, if I post a microblog, everyone who follows me can see it.

In the big data world, there is a distributed, persistent product for the generation and consumption of millions of messages to meet the increasing volume of data – RabbitMQ.

V Install dependencies

RabbitMQ is developed using the Erlang language, so we will install Erlang first.

The RPM - Uvh http://www.rabbitmq.com/releases/erlang/erlang-18.1-1.el7.centos.x86_64.rpm

RabbitMQ is based on Erlang, so RabbitMQ and Erlang versions need to match, otherwise the installation may fail. RabbitMQ Erlang Version Requirements – RabbitMQ

vInstall RabbitMQ-Server

The RPM - Uvh http://www.rabbitmq.com/releases/rabbitmq-server/v3.5.6/rabbitmq-server-3.5.6-1.noarch.rpm

Once installed, verify that the installation was successful. rpm -qa|grep rabbitmq

Start MQ: service rabbitmq-server start

To restart the MQ server, run the service rabbitmq-server restart command

To disable the MQ service, run the service rabbitmq-server stop command

Check the rabbitmqctl status

V Maintenance Plug-in

Start MQ first, then install the maintenance plug-in. rabbitmq-plugins enable rabbitmq_management

This command installs a management plug-in for RabbitMq

Check the installed rabbitmq-plugins list

Once installed, you can access an admin interface by visiting http://ip:15672 in your browser.

V Remote access

In this case, login failed is displayed

Remote access authorization needs to be enabled.

cd /etc/rabbitmq

Cp/usr/share/doc/the rabbitmq server - 3.5.6 / rabbitmq config. The example/etc/rabbitmq /

mv rabbitmq.config.example rabbitmq.config

vim /etc/rabbitmq/rabbitmq.config

Add {loopback_users, []} to rabbitmq.config

The default user name and password are guest, and the following information is displayed after login:

For more information on RabbitMQ Management, see here. SpringBoot(23) Integration with RabbitMQ- Discussion on RabbitMQ Management

V User Management

Add user rabbitmqctl add_user Username Password

Set admin rabbitmqctl set_user_tags Username administrator

User roles can be broadly divided into five categories: super administrator, Monitor, policy maker, general manager, and others.

Super administrator:

You can log in to the management console (with the Management Plugin enabled), view all information, and operate on users and policies.

Regulators (monitoring)

Log on to the management console (with the Management Plugin enabled) and view rabbitMQ node information (number of processes, memory usage, disk usage, etc.)

Policymaker

You can log into the administrative console (with the Management Plugin enabled) and manage policies. However, you cannot view the node information (marked by the red box in the figure above). Contrast this with administrator, who can see this

General manager

You can only log into the administrative console (with the Management Plugin enabled), and you cannot see node information or manage policies.

other

Unable to log on to the administrative console, it is usually the ordinary producer and consumer.

Example Delete a user rabbitmqctl delete_user Username

Change the password rabbitmqctl change_password Username Newpassword

View the current list of users rabbitmqctl list_users

 

Other references:

  • Installing on RPM- Based Linux (RHEL, CentOS, Fedora, openSUSE) – RabbitMQ www.rabbitmq.com/install-rpm…
  • EPEL/FAQ – Fedora Project Wiki fedoraproject.org/wiki/EPEL/F…
  • News – the RabbitMQ www.rabbitmq.com/news.html

About the author: Focus on basic platform project development. If you have any questions or suggestions, please feel free to comment! Copyright notice: The copyright of this article belongs to the author and the blog garden, welcome to reprint, but without the consent of the author must retain this statement, and give the original text link in a prominent place on the page of the article. For the record: all comments and messages will be answered as soon as possible. You are welcome to correct your mistakes and make progress together. Or direct private message I support the blogger: if you think the article is helpful to you, you can click on the lower right corner of the article [recommendation]. Your encouragement is the author to adhere to the original and continuous writing of the biggest power! \