Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

RabbitMQ Clustering on RHEL7

The version of RabbitMQ provided in the RHEL7 (and CentOS 7) repositories is too old and does not have declarative clustering available. Therefore, it is necessary to get a newer version of RabbitMQ and then to work around what is lacking in the newer package version.

Checklist:

  • Install PackageCloud RabbitMQ (official) RPM repository.
  • Install RabbitMQ >= 3.6.5.
  • Install SystemD unit.
  • Remove /etc/rc.d/init.d/rabbitmq-server.
  • Configure /etc/rabbitmq/rabbitmq-env.conf.
  • Configure /etc/rabbitmq/rabbitmq.config.
  • Restart RabbitMQ

Bonus Points:

  • Configure RabbitMQ to log only to standard output.

Yum Repo

/etc/yum.repos.d/rabbitmq.repo

[rabbitmq]
name="RabbitMQ"
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/$releasever/$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
sslverify=1

SystemD Unit

/etc/systemd/system/rabbitmq-server.service

[Unit]
Description=RabbitMQ broker
After=syslog.target network.target

[Service]
Type=notify
NotifyAccess=all
User=rabbitmq
Group=rabbitmq
WorkingDirectory=/var/lib/rabbitmq
ExecStart=/usr/lib/rabbitmq/bin/rabbitmq-server
ExecStop=/usr/lib/rabbitmq/bin/rabbitmqctl stop

[Install]
WantedBy=multi-user.target

RabbitMQ Configuration Files

/etc/rabbitmq/rabbitmq-env.conf

NODENAME=rabbit@%{::fqdn}
NODE_PORT=5672
USE_LONGNAME=true

/etc/rabbitmq/rabbitmq.config

[
  {rabbit, [
    {cluster_nodes, {['rabbit@rabbitmq-1.mydomain.com', 'rabbit@rabbitmq-2.mydomain.com', 'rabbit@rabbitmq-3.mydomain.com'], disc}},
    {cluster_partition_handling, autoheal},
% truncated for brevity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.