RabbitMQ Deployment (RHEL)
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---upgrade-guides/zephyr-on-premise-production-installation/zephyr-enterprise-services/rabbitmq-deployment/rabbitmq-deployment--rhel-.html
RabbitMQ - Deployment (RHEL - 9)
Setup RabbitMQ on RHEL with 1 node
Enable snaps on Red Hat Enterprise Linux and install Erlang/OTP
The EPEL repository can be added to RHEL 9 with the following command:
sudo dnf install
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo dnf upgrade
Note: -For another version please refer:Install Erlang/OTP on Red Hat Enterprise Linux using the Snap Store | Snapcraft
Snap can now be installed as follows:
sudo yum install snapd
Once installed, the systemd unit that manages the main snap communication socket needs to be enabled:
sudo systemctl enable --now snapd.socket
To enable classic snap support, enter the following to create a symbolic link between /var/lib/snapd/snap
and /snap
:
sudo ln -s /var/lib/snapd/snap /snap
Either log out and back in again or restart your system to ensure snap’s paths are updated correctly.
Install Erlang/OTP
To install Erlang/OTP, simply use the following command:
sudo snap install erlang --classic
Install RabbitMQ Server (RHEL-9)
Install RabbitMQ and Cloudsmith Signing Keys​
Yum will verify signatures of any packages it installs, therefore the first step in the process is to import the signing key.
## primary RabbitMQ signing key
rpm --import 'https://github.com/rabbitmq/signing-keys/releases/download/3.0/rabbitmq-release-signing-key.asc'
## modern Erlang repository
rpm --import 'https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.E495BB49CC4BBE5B.key'
## RabbitMQ server repository
rpm --import 'https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.9F4587F226208342.key'
Add Yum Repositories for RabbitMQ and Modern Erlang​
In order to use the Yum repository, a .repo
file (e.g. rabbitmq.repo
) has to be added under the /etc/yum.repos.d/
directory.
These repository mirrors only provide 64-bit x86 (amd64
) packages of Erlang.
For more installing details please refer:Installing on RPM-based Linux | RabbitMQ
Install Packages with dnf (yum)​
Update package metadata:
dnf update -y
Next install dependencies from the standard repositories:
## install these dependencies from standard OS repositories
dnf install socat logrotate -y
Finally, install modern Erlang and RabbitMQ:
## install RabbitMQ and zero dependency Erlang
dnf install -y erlang rabbitmq-server
After the installation is complete, you can typically start and manage the RabbitMQ server using systemctl commands.
systemctl start rabbitmq-server # Start RabbitMQ server
systemctl enable rabbitmq-server # Enable RabbitMQ server to start on boot
systemctl status rabbitmq-server # Check status of RabbitMQ 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.
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.
sudo rabbitmqctl set_user_tags [user_id] administrator
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.
sudo rabbitmqctl set_permissions -p / [user_id] ".*" ".*" ".*"
To delete the user use the below command
sudo rabbitmqctl delete_user [user_id]
Run the below command to list all available users (
list_users
) on the RabbitMQ cluster.
sudo rabbitmqctl list_users
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
.
sudo rabbitmq-plugins enable rabbitmq_management
#For restart
sudo systemctl restart rabbitmq-server
At this point, the RabbitMQ management plugin is enabled and listens on port 15672. You can check it with the following command:
ss -antpl | grep 15672
Â
RabbitMQ - Cluster Deployment (RHEL - 9)
Setup RabbitMQ on RHEL 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:
nano /etc/hosts
Add the following lines with your cluster IP address:
172.x.x.x1 RabbitMQ-Cluster-Node-1
172.x.x.x2 RabbitMQ-Cluster-Node-2
172.x.x.x3 RabbitMQ-Cluster-Node-3
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.
ping -c 3 RabbitMQ-Cluster-Node-1
ping -c 3 RabbitMQ-Cluster-Node-2
ping -c 3 RabbitMQ-Cluster-Node-3
Enable snaps on Red Hat Enterprise Linux and install Erlang/OTP
The EPEL repository can be added to RHEL 9 with the following command:
sudo dnf install
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo dnf upgrade
Note: -For another version please refer: Install Erlang/OTP on Red Hat Enterprise Linux using the Snap Store | Snapcraft
Snap can now be installed as follows:
sudo yum install snapd
Once installed, the systemd unit that manages the main snap communication socket needs to be enabled:
sudo systemctl enable --now snapd.socket
To enable classic snap support, enter the following to create a symbolic link between /var/lib/snapd/snap
and /snap
:
sudo ln -s /var/lib/snapd/snap /snap
Either log out and back in again or restart your system to ensure snap’s paths are updated correctly.
Install Erlang/OTP
To install Erlang/OTP, simply use the following command:
sudo snap install erlang --classic
Install RabbitMQ Server (RHEL-9)
Install RabbitMQ and Cloudsmith Signing Keys​
Yum will verify signatures of any packages it installs, therefore the first step in the process is to import the signing key
## primary RabbitMQ signing key
rpm --import 'https://github.com/rabbitmq/signing-keys/releases/download/3.0/rabbitmq-release-signing-key.asc'
## modern Erlang repository
rpm --import 'https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.E495BB49CC4BBE5B.key'
## RabbitMQ server repository
rpm --import 'https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.9F4587F226208342.key'
Add Yum Repositories for RabbitMQ and Modern Erlang​
In order to use the Yum repository, a .repo
file (e.g. rabbitmq.repo
) has to be added under the /etc/yum.repos.d/
directory.
These repository mirrors only provide 64-bit x86 (amd64
) packages of Erlang.
For more installing details please refer: Installing on RPM-based Linux | RabbitMQ
Install Packages with dnf (yum)​
Update package metadata:
dnf update -y
Next install dependencies from the standard repositories:
## install these dependencies from standard OS repositories
dnf install socat logrotate -y
Finally, install modern Erlang and RabbitMQ:
## install RabbitMQ and zero dependency Erlang
dnf install -y erlang rabbitmq-server
After the installation is complete, you can typically start and manage the RabbitMQ server using systemctl commands.
systemctl start rabbitmq-server # Start RabbitMQ server
systemctl enable rabbitmq-server # Enable RabbitMQ server to start on boot
systemctl status rabbitmq-server # Check status of RabbitMQ server
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.
# List files and directories on /var/lib/rabbitmq
ls -lah /var/lib/rabbitmq
# Print content of the file .erlang.cookie
cat /var/lib/rabbitmq/.erlang.cookie
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.
sudo systemctl stop rabbitmq-server
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.
# content of .erlang.cookie from server 1
KZLPEPHVOZNLSARUVIOO
Now, run the below command to start the
rabbitmq-server
service.sudo systemctl start rabbitmq-server
Run the following
rabbitmqctl
commands on server 2 and server 3 to add them to the RabbitMQ cluster (server 1).
# Stop RabbitMQ application
sudo rabbitmqctl stop_app
# Reset RabbitMQ application
sudo rabbitmqctl reset
# Join the RabbitMQ server 1
sudo rabbitmqctl join_cluster rabbit@RabbitMQ-Cluster-Node-1
# Start the RabbitMQ application again
sudo rabbitmqctl start_app
Finally, execute the
rabbitmqctl
command below to verify the RabbitMQ cluster status. You can run this from any server.sudo rabbitmqctl cluster_status
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.
sudo rabbitmqctl set_user_tags [user_id] administrator
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.
sudo rabbitmqctl set_permissions -p / [user_id] ".*" ".*" ".*"
To delete the user, use the below command:
sudo rabbitmqctl delete_user [user_id]
Run the below command to list all available users (
list_users
) on the RabbitMQ cluster.
sudo rabbitmqctl list_users
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
.
sudo rabbitmq-plugins enable rabbitmq_management
#For restart
sudo systemctl restart rabbitmq-server
At this point, the RabbitMQ management plugin is enabled and listens on port 15672. You can check it with the following command:
ss -antpl | grep 15672
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