For high availability, you must first configure a RabbitMQ cluster with a master node
(primary server) and a secondary node (secondary server). After a working cluster is created,
you can mirror the nodes. This ensures that when the master node is unavailable, the secondary
node can be reached so no data is lost.
What you should know
All servers in the RabbitMQ cluster must be on the same domain and on the same LAN
(local area network).
Procedure
-
Configure a RabbitMQ cluster.
-
Copy the .erlang.cookie file from the master node to the secondary
node.
This file is located in two places on the master node, it must be copied to the
same two locations on the secondary node:
-
Restart the RabbitMQ service on the secondary node.
-
On your RabbitMQ master node, open the RabbitMQ Command Prompt and enter:
C:\Program Files\RabbitMQ Server\rabbitmq_server-<version>\sbin\rabbitmqctl start_app
Where <version> is the version number of your RabbitMQ
installation package.
-
On the secondary node, open the RabbitMQ Command Prompt and enter:
C:\Program Files\RabbitMQ Server\rabbitmq_server-<version>\sbin\rabbitmqctl stop_app
C:\Program Files\RabbitMQ Server\rabbitmq_server-<version>\sbin\rabbitmqctl join_cluster rabbit@<MasterNodeName>
C:\Program Files\RabbitMQ Server\rabbitmq_server-<version>\sbin\rabbitmqctl start_app
NOTE: <MasterNodeName> is case sensitive.
This adds the secondary node to a cluster with the master node.
-
Mirror the RabbitMQ master and secondary node.
On either the master or secondary node, open the RabbitMQ Command Prompt and
enter:
C:\Program Files\RabbitMQ Server\rabbitmq_server-<version>\sbin\rabbitmqctl set_policy ha-all "" "{""ha-mode"":""all""}"