Manually Deploying RabbitMQ (CentOS 7.4)
Overview
The best practices for Huawei Cloud ECS guide you through the manual deployment of RabbitMQ on a Linux ECS. RabbitMQ is a message middleware that uses the Erlang programming language for the Advanced Message Queuing Protocol (AMQP). It originates from the financial system and is used to store and forward messages in the distributed system. Featuring high reliability, scalability, availability, and rich functions, RabbitMQ is widely used.
Prerequisites
The rule listed in the following table has been added to the security group which the target ECS belongs to. For details, see Adding a Security Group Rule.
Direction |
Priority |
Action |
Type |
Protocol & Port |
Source Address |
---|---|---|---|---|---|
Inbound |
1 |
Allow |
IPv4 |
TCP: 5672 |
0.0.0.0/0 |
Inbound |
1 |
Allow |
IPv4 |
TCP: 15672 |
0.0.0.0/0 |
Procedure
- Install the dependency package and perl.
- Install Erlang.
For details, see Erlang Packages Download.
- Run the following commands to add Erlang Solutions repository to your system:
wget https://packages.erlang-solutions.com/erlang-solutions-2.0-1.noarch.rpm
rpm -Uvh erlang-solutions-2.0-1.noarch.rpm
Alternatively, add the repository entry manually.
rpm --import https://packages.erlang-solutions.com/rpm/erlang_solutions.asc
- In the /etc/yum.repos.d/ directory, create a file named rabbitmq-erlang.repo, and add the following to the file:
cd /etc/yum.repos.d/
vi rabbitmq-erlang.repo[erlang-solutions] name=CentOS $releasever - $basearch - Erlang Solutions baseurl=https://packages.erlang-solutions.com/rpm/centos/$releasever/$basearch gpgcheck=1 gpgkey=https://packages.erlang-solutions.com/rpm/erlang_solutions.asc enabled=1
Press Esc to exit insert mode. Then, enter :wq to save the settings and exit.
- Run the following command to install Erlang:
Run the following command to install esl-erlang:
sudo yum install esl-erlang
- Run the following command to check the installation result:
If information similar to the following is displayed, Erlang has been installed:
[root@ecs-rabbitmq ~]# erl -version Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 11.1.7
- Run the following commands to add Erlang Solutions repository to your system:
- Install RabbitMQ.
- Run the following command to go to the home directory:
- Perform the following steps to download the RabbitMQ installation package:
- Open RabbitMQ.
- Click Get Started.
Figure 1 Get Started
- Click Download+Installation.
Figure 2 Download+Installation
- Select a download address based on the ECS OS. Here, the CentOS 7.x is used as an example.
Figure 3 Selecting a download address
- Run the following command to download the RabbitMQ installation package.
For example, the download address in 3.b.iv is as follows:
Run the following command:
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.12/rabbitmq-server-3.8.12-1.el7.noarch.rpm
If the message Unable to establish SSL connection. is displayed during the download,
you can add --no-check-certificate to the end of the wget command and repeat it for several times for download.
For example:
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.12/rabbitmq-server-3.8.12-1.el7.noarch.rpm --no-check-certificate
- Run the following command to install the RabbitMQ installation package:
- Start the RabbitMQ after it is installed.
- Check the RabbitMQ status.
- Run the following command to enable the RabbitMQ management web page:
rabbitmq-plugins enable rabbitmq_management
Information similar to the following is displayed:
[root@ecs-rabbitmq ~]# rabbitmq-plugins enable rabbitmq_management Enabling plugins on node rabbit@ecs-rabbitmq: rabbitmq_management The following plugins have been configured: rabbitmq_management rabbitmq_management_agent rabbitmq_web_dispatch Applying plugin configuration to rabbit@ecs-2b36... The following plugins have been enabled: rabbitmq_management rabbitmq_management_agent rabbitmq_web_dispatch started 3 plugins.
- Run the following command to create a user:
rabbitmqctl add_user Username password
For example, run the following command:
rabbitmqctl add_user root 123456
- Run the following command to set the user as the administrator:
rabbitmqctl set_user_tags Username administrator
For example, run the following command:
rabbitmqctl set_user_tags root administrator
- Run the following command to assign all permissions to the user:
rabbitmqctl set_permissions -p / Username '.*' '.*' '.*'
For example, run the following command:
rabbitmqctl set_permissions -p / root '.*' '.*' '.*'
- Run the following command to start RabbitMQ on the backend:
rabbitmq-server -detached
- Enter http://EIP:15672 in the address bar to access RabbitMQ. If the following page is displayed, RabbitMQ has been installed.
- Enter the username and password of the account created in 5 to go to the RabbitMQ management page.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.