Linux in RabbitMQ installation tutorial

In doing a service project, when used in micro message queue, so in-depth knowledge to understand the message queue, and the installation Rabbitmq on linux, this blog describes the installation tutorial Rabbitmq, and want to understand the message queue related knowledge, please refer to the blog:

1. Update the basic system

Before installing any software package, it is recommended to use the following command to update the package and repository

yum -y update

2. Install Erlang

Since RabbitMQ is based on the Erlang (for high concurrent language) language development, so before you install RabbitMQ, you need to install Erlang. In this tutorial we will install the latest version of Erlang to the server. Erlang is not available in the default YUM repository, so you will need to install EPEL repository. Run the following command.

yum -y install epel-release

yum -y update

installationErlang

yum -y install erlang socat

You can now check Erlang version using the following command.

erl -version

You will get the following output:

[root@liptan-pc ~]# erl -version
Erlang (ASYNC_THREADS,HIPE) (BEAM) emulator version 5.10.4

2. Install RabbitMQ

RabbitMQ is pre-compiled and can be directly installed Enterprise Linux system provides RPM packages. The only dependency is installed into the system Erlang. We have installed Erlang, we can further download RabbitMQ. By running download Erlang RPM package.

RabbitMQ 2.1 download

Download RabbitMQ

wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server-3.6.10-1.el7.noarch.rpm

If you do not have wget installed, you can run yum -y install wget. You can find the link to the download page of the latest version of RabbitMQ at any time.

2.2 Installation RabbitMQ

Import GPG key by running:

rpm –import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc

Run RPM install RPM package:

rpm -Uvh rabbitmq-server-3.6.10-1.el7.noarch.rpm

RabbitMQ are already installed on your system.

3. Use RabbitMQ

run

systemctl start rabbitmq-server

Boot from Kai

systemctl enable rabbitmq-server

Check Status

systemctl status rabbitmq-server

4. Access Web Console

4.1 start the web console

Start RabbitMQ Web management console, by running:

rabbitmq-plugins enable rabbitmq_management

By running the following command, the file ownership RabbitMQ RabbitMQ is provided to the user:

chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/

4.2 Creating a User

Now, you will need to create an administrative user RabbitMQ Web management console. Run the following command.

rabbitmqctl add_user admin StrongPassword
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p / admin “.*” “.*” “.*”

The administrator changes the administrator user's preferred user name. Be sure to change the StrongPassword very strong password.

To access the administration panel RabbitMQ, use your favorite Web browser and open the following URL.

http://Your_Server_IP:15672/

5. Management Interface Introduction

First visit need to log in, the default account password is:guest/guest

5.1. Home

  • connections: Whether after the producer or the consumer, we need to establish a connection with RabbitMQ can complete the production and consumption of messages, where you can see the connection
  • channels: channel, the connection is established, the formation of the channel, dependent on the delivery message acquisition channel.
  • Exchanges: switch to route messages to achieve
  • Queues: Queue, the message queue, the message is stored in a queue, waiting for the consumer, the consumer after the removal of the queue.

port:

5.2 Add User.

Tags above options, in fact, is to specify the user's role, optional are the following:

  • Super Administrator (administrator)

    Can be found on the management console, you can view all the information, and can operate on a user policy (policy).

  • Monitoring those (monitoring)

    Can be found on the management console, and can view information rabbitmq nodes (number of processes, memory usage, disk usage, etc.)

  • Policy makers (policymaker)

    Can be found on the management console, and can manage the policy. But you can not see the node information (section identified on the red box).

  • General manager (management)

    Can be found only management console, can not see the node information, the policy can not be managed.

  • other

    You could not land management console, often it is the producers and consumers.

5.3. Create a virtual host (Virtual Hosts)

In order to allow each user can interfere with each other's work, RabbitMQ adds the concept of virtual host (Virtual Hosts) is. In fact, a separate access path, different users use different paths, each with its own queue, switches, will not affect each other.

Create a good web hosting, we need to add access to the user:

Click Add good web hosting:

Enter the virtual host settings interface:

Guess you like

Origin www.linuxidc.com/Linux/2020-01/161901.htm