RabbitMQ Deployment (Ubuntu)
Starting October 11, 2024 (Zephyr Enterprise 8.2), the Zephyr Enterprise documentation moved from its current location on Atlassian to a dedicated, standalone Zephyr Enterprise documentation page. Please see: https://support.smartbear.com/zephyr-enterprise/docs/en/zephyr-enterprise/zephyr-installation-and-upgrade-guides/zephyr-on-premise-production-installation/zephyr-enterprise-services/rabbitmq-deployment/rabbitmq-deployment--ubuntu-.html
RabbitMQ - Deployment (Ubuntu)
Setup RabbitMQ on Ubuntu with 1 node
Install RabbitMQ Server (Ubuntu 3.12.10)
Install RabbitMQ packages on all servers:
Cloudsmith Quick Start Script.
Run the below script file to install RabbitMQ on Ubuntu.
For more installing details please refer: Installing on Debian and Ubuntu — RabbitMQNOTE:
In the above script file, we have used the Distribution as “focal” like below, since our Ubuntu version is 20.04.
deb [signed … /ubuntu focal main
deb-src [signed-by…ubuntu focal main
etc…Please replace “focal” and use the appropriate Distribution name in your script file from the below table.
jammy
for Ubuntu 23.04jammy
for Ubuntu 22.04focal
for Ubuntu 20.04bionic
for Ubuntu 18.04buster
for Debian Buster, Bullseye, and SidOnce the RabbitMQ server package is installed, start and enable the RabbitMQ service with the following command:
sudo systemctl start rabbitmq-server sudo systemctl enable rabbitmq-server
Lastly, run the following command to verify the
rabbitmq-server
service’s status.sudo systemctl status rabbitmq-server
You can also verify the version of RabbitMQ on your system using the following command.
sudo rabbitmq-diagnostics server_version
Setting up an Admin User for RabbitMQ
The RabbitMQ admin user has permission to configure, read, and write any entity available on the RabbitMQ cluster.
Run the
rabbitmqctl
command below to create a new user with userId and password.
sudo rabbitmqctl add_user [user_id] [password]
Run the following command to set (
set_user_tags
) the new user (user_id
) asadministrator
for the RabbitMQ cluster.
Run the command to
set_permissions
to the new user with the following:
Allows (
-p /
)[user_id]
user to access all vhosts on the RabbitMQ cluster.First
".*"
– Allows the user to configure permission for every entity and vhosts.Second
".*"
– Enables write-permission for the user to every entity and vhosts.Third
".*"
– Enables read-permission for the user to every entity and vhosts.
To delete the user, use the below command:
Run the below command to list all available users (
list_users
) on the RabbitMQ cluster.
Note: Once RabbitMQ UI is up you can log in by using the above username and password
Enabling the RabbitMQ Management Plugin
The RabbitMQ Management Plugin provides a web-based management UI running on default port 15672
and the command-line management tool [rabbitmqadmin]
Run the rabbitmq-plugins
command below on all servers to enable the rabbitmq_management
plugin. This command automatically enables other necessary plugins, such as rabbitmq_management_agent
and rabbitmq_web_dispatch
.
At this point, the RabbitMQ management plugin is enabled and listens on port 15672. You can check it with the following command:
RabbitMQ - Cluster Deployment (Ubuntu)
Setup RabbitMQ Cluster on Ubuntu with 3 nodes
Setup Hostname Resolution
Before setting up the RabbitMQ cluster, you will need to set up hostname resolution on all servers. So each server can communicate with each other by hostname.
To do so, edit the /etc/hosts file on all cluster servers:
Add the following lines with your cluster IP address:
Make sure to provide the same hostname shown in your terminal, in the/etc/hosts
file.
Now, run the ping
command below to verify each hostname resolves to the correct IP address of the server. Each -c 3
option makes ping
requests three times, then terminates the requests.
Install RabbitMQ Server (Ubuntu 3.12.10)
Install RabbitMQ packages on all servers:
Cloudsmith Quick Start Script.
Run the below script file to install RabbitMQ on Ubuntu.
For more installing details please refer: Installing on Debian and Ubuntu — RabbitMQ
NOTE:
In the above script file, we have used the Distribution as “focal” like below, since our Ubuntu version is 20.04.
deb [signed … /ubuntu focal main
deb-src [signed-by…ubuntu focal main
etc…Please replace “focal” and use the appropriate distribution name in your script file from the below table.
jammy
for Ubuntu 23.04jammy
for Ubuntu 22.04focal
for Ubuntu 20.04bionic
for Ubuntu 18.04buster
for Debian Buster, Bullseye, and SidOnce the RabbitMQ server package is installed, start and enable the RabbitMQ service with the following command:
Lastly, run the following command to verify the
rabbitmq-server
service’s status.sudo systemctl status rabbitmq-server
You can also verify the version of RabbitMQ on your system using the following command.
Configure RabbitMQ Cluster
RabbitMQ is an application written in Erlang and by default, provides a .erlang.cookie file on the RabbitMQ data directory (/var/lib/rabbitmq).
To create a RabbitMQ cluster, you’ll set up a .erlang.cookie file in each server with the same content and must be owned by the rabbitmq
user and group.
On server 1, execute the following command to check available files on the RabbitMQ data directory (
/var/lib/rabbitmq
). The command then prints the content of the.erlang.cookie
file.
Copy the output (KZLPEPHVOZNLSARUVIOO) to your note because you’ll add this output to the s in server 2 and server 3 in the following steps. Mind you that you may get a different output of the .erlang.cookie.
file than what’s shown below.
Next, move to server 2 and server 3, and run the following command to
stop
therabbitmq
service.
Edit the
/var/lib/rabbitmq/.erlang.cookie
file in your preferred text editor. Replace the original content with the one you noted in step one, save the changes and exit the editor.
Now, run the below command to start the
rabbitmq-server
service.Run the following:
rabbitmqctl
commands on server 2 and server 3 to add them to the RabbitMQ cluster (server 1).
Finally, execute the
rabbitmqctl
command below to verify the RabbitMQ cluster status. You can run this from any server.
Setting up an Admin User for RabbitMQ
The RabbitMQ admin user has permission to configure, read, and write any entity available on the RabbitMQ cluster.
Switch to server 1 and run the
rabbitmqctl
command below to create a new user with userId and password.
Run the following command to set (
set_user_tags
) the new user (user_id
) asadministrator
for the RabbitMQ cluster.
Run the command to
set_permissions
to the new user with the following:
Allows (
-p /
)[user_id]
user to access all vhosts on the RabbitMQ cluster.First
".*"
– Allows the user to configure permission for every entity and vhosts.Second
".*"
– Enables write-permission for the user to every entity and vhosts.Third
".*"
– Enables read-permission for the user to every entity and vhosts.
To delete the user use below command
Run the below command to list all available users (
list_users
) on the RabbitMQ cluster.
Note: Once RabbitMQ UI is up you can log in by using the above username and password
Enabling the RabbitMQ Management Plugin
The RabbitMQ Management Plugin provides a web-based management UI running on default port 15672
and the command-line management tool [rabbitmqadmin]
Run the rabbitmq-plugins
command below on all servers to enable the rabbitmq_management
plugin. This command automatically enables other necessary plugins, such as rabbitmq_management_agent
and rabbitmq_web_dispatch
.
At this point, the RabbitMQ management plugin is enabled and listens on port 15672. You can check it with the following command:
Once everything is done, the three RabbitMQ clusters should be up in RabbitMQ UI
Starting Release 8.2, Zephyr Enterprise documentation is moving from its current location on Atlassian to a dedicated, standalone Zephyr Enterprise Documentation page. https://support.smartbear.com/zephyr-enterprise/docs/en/welcome-to-zephyr-enterprise.html