In this article
To create a cluster of RabbitMQ servers for performance and high availability, follow the following steps in addition to the previous steps on all servers.
Environment Variables
Add the following system environment variables (Start > Settings > Control Panel > System > Advanced > Environment Variables):
For server communication within the cluster we need to set the ERLANG cookie value to the same value on ALL servers that will join the cluster:
| Name | Default value | Suggested value |
|---|---|---|
| RABBITMQ_SERVER_ADDTITIONAL_ERL_ARGS | None | -setCookie ‘xxxxx’ |
Important
This cookie value is an arbitrary string value that must be the same on both variables on all the servers that will join the cluster.
Erlang Cookie File
RabbitMQ service will read this erlang cookie value from a file that is stored in
C:\windows\.erlang.cookie
If there is no file present, RabbitMQ will generate a file with an arbitrary string. This file is set to read only by default. Unticking the read-only option in the file properties will allow editing of this file. The text editor needs administrator privileges to edit this file.
Set the contents of the “.erlang.cookie” file to be the same on all nodes you want in the cluster, as well as in the environment variables from previous step.
Restart the RabbitMQ service to pick up any changes to the erlang cookie.
Joining the Cluster
Run the following command and note down the nodename on the first server
rabbitmqctl status
This command will return the following
Status of node 'rabbit@123456-SERVER1' ...
Log on to all the other servers that you want jo join into a cluster and run these commands on all of them:
rabbitmqctl stop_app
rabbitmqctl join_cluster ‘rabbit@123456-SERVER1'
rabbitmqctl start_app
Verifying the Configuration
Login to the web management GUI interface at http://localhost:15672 on any of the servers. Log in with default credentials:
Username: guest
Password: guest
Once you login you will see all your cluster nodes listed:
Figure 1 - Example of the list of cluster nodes