Table of Contents

Setup a RabbitMQ-Cluster

Environment Information

Prepare Repository

Execute on all nodes.

Setup the yum repository according to https://www.rabbitmq.com/install-rpm.html#package-cloud.

vim /etc/yum.repos.d/rabbitmq.repo
##
## Zero dependency Erlang
##

[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/8/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/8/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

##
## RabbitMQ server
##

[rabbitmq_server]
name=rabbitmq_server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/8/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_server-source]
name=rabbitmq_server-source
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/8/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

Update the cache. Accept the required keys from packetcloud.io and github.com.

dnf makecache

Install rabbitmq-server

Execute on all nodes.

Install the RabbitMQ-Server with all dependencies.

dnf install rabbitmq-server

Start the RabbitMQ-Server on system startup.

systemctl enable rabbitmq-server.service

Set the Erlang Cookie

Execute on mb1.

All nodes in the cluster must have the same erlang cookie. We copy it fro mb1 to the other nodes.

scp /var/lib/rabbitmq/.erlang.cookie mb2:/var/lib/rabbitmq/.erlang.cookie
scp /var/lib/rabbitmq/.erlang.cookie mb3:/var/lib/rabbitmq/.erlang.cookie

Create Config File

https://github.com/rabbitmq/rabbitmq-server/blob/v3.8.x/deps/rabbit/docs/rabbitmq.conf.example

vim /etc/rabbitmq/rabbitmq.conf

Example configuration file with transport security.

# Defaults
num_acceptors.tcp   = 10
handshake_timeout   = 10000
channel_max         = 2048

# AMQP
listeners.tcp.default = 5672

# AMQP with TLS
listeners.ssl.default = 5671
 
ssl_options.cacertfile = /etc/rabbitmq/chain.crt
ssl_options.certfile   = /etc/rabbitmq/mb1.int.example.org.crt
ssl_options.keyfile    = /etc/rabbitmq/mb1.int.example.org.key
ssl_options.verify     = verify_none
ssl_options.fail_if_no_peer_cert = false

ssl_options.versions.1 = tlsv1.3
ssl_options.versions.2 = tlsv1.2

# Management
management.ssl.port       = 15672
management.ssl.cacertfile = /etc/rabbitmq/chain.crt
management.ssl.certfile   = /etc/rabbitmq/mb1.int.example.org.crt
management.ssl.keyfile    = /etc/rabbitmq/mb1.int.example.org.key

management.ssl.versions.1 = tlsv1.3
management.ssl.versions.2 = tlsv1.2
 
# Cluster
cluster_name = mb.int.example.org
cluster_partition_handling = autoheal
cluster_formation.peer_discovery_backend = classic_config
 
cluster_formation.classic_config.nodes.1 = rabbit@mb1
cluster_formation.classic_config.nodes.2 = rabbit@mb2
cluster_formation.classic_config.nodes.3 = rabbit@mb3

# Promometheus
#prometheus.tcp.port = 15692
#prometheus.ssl.port = 15691
#prometheus.return_per_object_metrics = false
#prometheus.path = /metrics
scp /etc/rabbitmq/rabbitmq.conf mb2:/etc/rabbitmq/
scp /etc/rabbitmq/rabbitmq.conf mb3:/etc/rabbitmq/