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: RabbitMQ Deployment (RHEL) | Zephyr Enterprise Documentation

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:

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:

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.

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:https://www.rabbitmq.com/docs/install-rpm

Install Packages with dnf (yum)

Update package metadata:

Next install dependencies from the standard repositories:

Finally, install modern Erlang and RabbitMQ:

After the installation is complete, you can typically start and manage the RabbitMQ server using systemctl commands.

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.

  1. Run the rabbitmqctl command below to create a new user with userId and password.

  1. Run the following command to set (set_user_tags) the new user (user_id) as administrator for the RabbitMQ cluster.

  1. Run the command toset_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.

  1. To delete the user use the below command

  1. 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 (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:

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.

86fd0b4d-6780-4f42-aeb7-e148a11edec8.png

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.

Enable snaps on Red Hat Enterprise Linux and install Erlang/OTP

The EPEL repository can be added to RHEL 9 with the following command:

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:

Once installed, the systemd unit that manages the main snap communication socket needs to be enabled:

To enable classic snap support, enter the following to create a symbolic link between /var/lib/snapd/snap and /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:

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

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: https://www.rabbitmq.com/docs/install-rpm

Install Packages with dnf (yum)

Update package metadata:

Next install dependencies from the standard repositories:

Finally, install modern Erlang and RabbitMQ:

After the installation is complete, you can typically start and manage the RabbitMQ server using systemctl commands.

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.

  1. 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.

f7d67f71-c87d-4873-9746-eee399b4652a.png
  1. Next, move to server 2 and server 3, and run the following command to stop the rabbitmq service.

  1. 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.

  1. Now, run the below command to start the rabbitmq-server service.

  2. Run the following

rabbitmqctl commands on server 2 and server 3 to add them to the RabbitMQ cluster (server 1).

  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.

  1. Run the rabbitmqctl command below to create a new user with userId and password.

  1. Run the following command to set (set_user_tags) the new user (user_id) as administrator for the RabbitMQ cluster.

  1. Run the command toset_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.

  1. To delete the user, use the below command:

  1. 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: