Setting up message queue clustering


In order to setup clustering for a message queue, heira data for each message queue node will need to be updated.

rabbitmq::cluster_node_type: 'disc'
rabbitmq::cluster_nodes: ['','hostname.node.two']
rabbitmq::config_cluster: true
rabbitmq::wipe_db_on_cookie_change: true

Add the following puppet property to secrets.yaml. This Value is the secret used by message queue nodes to join the cluster and should be generated at random.

rabbitmq::erlang_cookie: XXX

Proceed with the puppet installation and deployment of the updated configuration, or update the server configuration as applicable for your environment.

Next, run the following commands:

on node 1:
rabbitmqctl stop_app
on node 2:
rabbitmqctl stop_app
on node 1:
rabbitmqctl reset
rabbitmqctl start_app
on node 2:
rabbitmqctl reset
rabbitmqctl start_app

The status of the cluster can be checked with the following command on any node:

rabbitmqctl cluster_status

Command Line

An alternative approach to cluster setup is to run a set of commands in a terminal.

  1. Edit /var/lib/rabbitmq/.erlang.cookie so the value is the same on all message queue nodes
  2. Run puppet so message queue is installed on each node running separately.

On the second node run the following to join the cluster on node one:

rabbit2$ rabbitmqctl stop_app
rabbit2$ rabbitmqctl join_cluster rabbit@rabbit1
rabbit2$ rabbitmqctl start_app

The name of the node in the second command i.e. rabbit@rabbit1 can be found by running rabbitmqctl cluster_status on the rabbit1 node.

Repeat for any other message queue nodes.

Additional Information

  • Nodes must be able to communicate on port 4369
  • Nodes must be able to access each other by short or long hostname. The short name is the default rabbitmq configuration.
  • Each hostname must be the full FQDN name