Skip to content

Instantly share code, notes, and snippets.

@naftulikay
Last active September 22, 2016 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naftulikay/1c62c37e7f753aaa2f92b89d4d32fbcf to your computer and use it in GitHub Desktop.
Save naftulikay/1c62c37e7f753aaa2f92b89d4d32fbcf to your computer and use it in GitHub Desktop.

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