Installing RabbitMQ on Linux

Pre-Installation Task

RabbitMQ has dependencies on the third-party package socat and logrotate. Before you install the RabbitMQ, run the rpm -qa|grep socat and rpm -qa|grep logrotate commands to check whether they have been installed on the server. If they have not been installed yet, you can choose either option below to install the dependencies.

oOnline Install: run the yum -y install socat and yum -y install logrotate commands to install them online.

oOffline Install: refer to Offline Installing Third-party Dependencies for more details.

Note: If the Service Monitor Agent was not previously installed, it will be installed with RabbitMQ. You'll need to use the interactive command line to install it. See Installing MongoDB on Linux for more details. You can also install the Service Monitor Agent separately before installing RabbitMQ.

Installing RabbitMQ on Linux

1.Log in to the Linux server as the root user.

2.Run the mkdir command to create a directory under the /opt directory to place the installation package. For example, netbraintemp10.0a.

3.Run the cd /opt/netbraintemp10.0a command to navigate to the /opt/netbraintemp10.0a directory.

4.Download the installation package.

Option 1: If the Linux server has no access to the Internet, obtain the rabbitmq-linux-x86_64-rhel-3.8.16-10.0a.tar.gz file from NetBrain and then upload it to the /opt/netbraintemp10.0a directory by using a file transfer tool.  

Option 2: If the Linux server has access to the Internet, run the
wget <download link> command under the /opt/netbraintemp10.0a directory to directly download the rabbitmq-linux-x86_64-rhel-3.8.16-10.0a.tar.gz file from NetBrain official download site.

Note: Contact NetBrain Support Team to get the download link. The download link is case-sensitive.

Tip: Run the yum -y install wget command to install the wget command if it has not been installed on the server.

5.Run the tar -zxvf rabbitmq-linux-x86_64-rhel-3.8.16-10.0a.tar.gz command under the /opt/netbraintemp10.0a directory to extract installation files.

[[email protected] netbraintemp10.0a]# tar -zxvf rabbitmq-linux-x86_64-rhel-3.8.16-10.0a.tar.gz
rabbitmq/
rabbitmq/config/
rabbitmq/config/setup.conf
...
rabbitmq/install.sh
..

6.Run the cd rabbitmq/config command to navigate to the config directory.

7.Modify the parameters in the setup.conf file and save the changes. For how to modify the configuration file, refer to Editing a File with VI Editor.

[[email protected] config]# vi setup.conf
#RabbitMQ configuration file
 
#Account info
#The UserName or Password should not contain: {}[]:",'|<>@&^%\ or a space
#The length of UserName or Password should not be more than 64 characters
UserName=admin 
Password=Admin1.# 
 
# Mode (Mode can only be 'mirror' or 'standalone')
Mode=standalone
 
# A unique cluster string is used to join all cluster nodes. Each cluster node must have the same cluster ID.
ClusterId=rabbitmqcluster
 
# The role of the current node in the cluster. One or two roles can be configured:
# master or slave. 
NodeRole=master
# Must specify a resolvable hostname of the master node in either standalone or mirror mode.
MasterNode=localhost 
 
# Resource limitation
ResourceLimit=no
 
# CPULimit and MemoryLimit should be ended by % and the range is from 1% to 100%
CPULimit=100%
MemoryLimit=100%
 
# TLS
UseSSL=no
Certificate=/etc/ssl/cert.pem
PrivateKey=/etc/ssl/key.pem
 
# Port --Please enter the same Port for all nodes that belong to the same cluster
Port=5672
 
# Log path
LogPath=/var/log/rabbitmq

8.Run the cd .. command to navigate to the rabbitmq directory.

9.Run the ./install.sh script under the rabbitmq directory to install RabbitMQ.

[[email protected] rabbitmq]# ./install.sh
INFO: Start checking date
INFO: Start checking os
INFO: Start checking required CPU
INFO: Start checking minimum memory
INFO: Selinux-policy version: 3.13.1
INFO: Component Name: RabbitMQ
INFO: RPM name: rabbitmq-server
INFO: Service name: rabbitmq-server
INFO: RPM package list: erlang-23.2.1-1.el7.x86_64.rpm rabbitmq-server-3.8.16-1.el7.noarch.rpm
INFO: Installation path: /usr/lib/rabbitmq/
INFO: Config path: /etc/rabbitmq/
INFO: Preprocessing SUCCEEDED
...
Preparing...                          ########################################
Updating / installing...
rabbitmq-server-3.8.16-1.el7           ########################################
INFO: Official rpm package installing SUCCEEDED
INFO: Configuration parameters updating SUCCEEDED
INFO: Permission setting SUCCEED
Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to 
/usr/lib/systemd/system/rabbitmq-server.service.
rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2020-07-13 16:04:46 EDT; 8ms ago
 Main PID: 53927 (beam.smp)
   Status: "Initialized"
   Memory: 70.8M (limit: 15.5G)
...
INFO: Backing up uninstall.sh SUCCEEDED
INFO: Successfully installed RabbitMQ

10. Run the systemctl status rabbitmq-server command to verify whether its service starts successfully.

[[email protected] ~]# systemctl status rabbitmq-server
 rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2020-07-13 16:05:23 EDT; 13min ago
   Process: 19522 ExecStop=/usr/sbin/rabbitmqctl shutdown (code=exited, status=0/SUCCESS)
 Main PID: 4509 (beam.smp)
   Status: "Initialized"
   Memory: 96.5M
...

Parameters

The following table describes the parameters that can be configured when installing RabbitMQ.

Parameter

Default Value

Description

Username

admin

Specify the admin username used to connect to RabbitMQ.

Note: The username and password cannot contain any of the following special characters, and its length cannot exceed 64 characters.
{ } [ ] : " , ' | < > @ & ^ % \ and spaces

Note: Each member in a cluster must have the same username and password.

Password

Admin1.#

Specify the admin password used to connect to RabbitMQ.

Mode

standalone

Set the RabbitMQ deployment Mode. Available options are standalone or mirror.

Keep the default value standalone for a standalone deployment.If you plan to deploy a cluster, modify the default value to mirror.

ClusterId

rabbitmqcluster

Specify the cluster id used by all nodes to join the cluster. This parameter is required only for cluster deployments.

Note: Each member in a cluster must have the same cluster ID.

Note: Make sure that you don’t reuse the same cluster ID, otherwise you might end up with nodes joining the wrong cluster.

NodeRole

master

Set the role for the current node. Available options are master or slave.

Keep the default value for a standalone deployment. If you plan to deploy a cluster, modify it to slave on the other node.

MasterNode

localhost

This parameter is required for both standalone and cluster deployments. For standalone Mode, this parameter should be set as a resolvable hostname of the local server.

If you plan to deploy a cluster, always enter a resolvable hostname of the master node.

Note: FQDN and IP address are NOT supported.

ResourceLimit

no

Set whether to limit the system resource usage for RabbitMQ.

CPULimit

100%

Specify the maximum CPU utilization of the machine that can be consumed by RabbitMQ.

MemoryLimit

100%

Specify the maximum memory capacity of the machine that can be consumed by RabbitMQ.

UseSSL

no

Set whether to enable the encrypted connections to RabbitMQ by using SSL.

Tip: If UseSSL is set to yes, you can follow the steps below to modify the RabbitMQ Plugin config file after the service monitor is installed.

1)Run the vi /etc/netbrain/nbagent/check/rabbitmq.yaml command to open the RabbitMQ Plugin config file.

2)Set the ssl value to true and save the changes. For how to modify the configuration file, see Editing a File with VI Editor for more details.

[[email protected] check]# vi rabbitmq.yaml
init_config:
 
instances:
    - name: default
      managementPort: 15672,
      checkAvailableIntervalSeconds: 300
      ssl: true
      collectQueues:
          equal: []
          startWith: ['FullTextSearch','TaskManager','event_callback','RMClientCallback','ETL_Task']
          endWith: ['IndexDriver']

Certificate

/etc/ssl/cert.pem

Specify the storage path for all the certificates and key files used for SSL authentication.

Note: It is required only if UseSSL is enabled.

PrivateKey

/etc/ssl/key.pem

Specify the name of SSL private key file.

Note: It is required only if UseSSL is enabled.

Port

5672

Specify the port number that RabbitMQ service listens to.

LogPath

/var/log/rabbitmq

Specify the directory to save logs of RabbitMQ.