Configure RabbitMQ Clusters

In environments with 2 or more RabbitMQ servers, you must configure them as a RabbitMQ cluster. If the customer's enviroment only has 1 RabbitMQ server, you can skip this task.

You can begin this task on any RabbitMQ server at a given geographic location. The server you begin with becomes the Master Node for the cluster.

  1. On one of the RabbitMQ servers at each geographic location, navigate to C:\Windows\Users\[username] and copy the file .erlang.cookie
  2. On one of the other RabbitMQ servers at that geographic location, navigate to C:\Windows\System32\config\systemprofile and paste the .erlang.cookie file. Then, navigate to C:\Windows\Users\[username] and paste the file there as well. In both cases, you can preserve the existing file by renaming it to erlang.cookie.old before pasting the new file.
  3. Restart the RabbitMQ services on the server to which you just copied the cookie file.
  4. Repeat the previous two steps on each RabbitMQ server at the geographic location except the Master Node.
  5. On the Master Node, open a command prompt, change to the sbin directory similar to the following example (the path to sbin may vary depending on your configuration):

    C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-<version number>\sbin\

  6. From that directory, run the following command:

    rabbitmqctl.bat set_policy ha-all "^.*" "{""ha-mode"":""all""}"

  7. From the same directory, run the following command:

    rabbitmqctl.bat cluster_status

  8. Make a note of the Master Node name returned by this command.
  9. On one of the other RabbitMQ servers at that geographic location, change to the sbin directory similar to the following example (the path to sbin may vary depending on your configuration):

    C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-<version number>\sbin\

  10. From that directory, run the following commands, where "rabbit@shorthostname" is the Master Node name obtained earlier:

    rabbitmqctl.bat stop_app

    rabbitmqctl.bat join_cluster rabbit@shorthostname

    rabbitmqctl.bat start_app

  11. Repeat the previous two steps on each RabbitMQ server at the geographic location except the Master Node.

To verify that a node has joined the cluster, repeat step 7 of this task. The cluster status will include a list of all running nodes in the cluster.

 

<< Previous Task | Configure RabbitMQ to Use SSL

 

Next Task | Configure RabbitMQ Clusters for Partition Recovery >>