Setting up RabbitMQ clustring on windows is very simple, however the documentation is not great.
Installing.
Get the latest version from erlang.org and rabbitmq.com.
Run the installers as administrator. Install erlang first.
After installing enable the management web interface.
- Navagate to ?the rabbitMq server sbin,?C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.2\sbin
- Open cmd at the location as admin and run the following:? rabbitmq-plugins enable rabbitmq_management
——Erlang cookies need to be the same —–
Open up the following in the firewall
Rule Type | Protocols and Ports | Program path | Specified local ports | Profile | Name |
Port | TCP | 5672, 15672 | Domain, Private, Public | RabbitMQ | |
Program | %ProgramFiles%\erl7.2.1\bin\erl.exe | Domain, Private, Public | Erlang | ||
Program | %ProgramFiles%\erl7.2.1\erts-7.2.1\bin\erl.exe | Domain, Private, Public | Erlang Run-Time System | ||
Program | %ProgramFiles%\erl7.2.1\erts-7.2.1\bin\epmd.exe | Domain, Private, Public | Erlang Port Mapper Daemon |
Before clustering the RabbitMQ nodes you will have to make sure RabbitMQ can resolve the host name of the RabbitMQ nodes. Because RabbitMq likes to use the short names you may not be able to find the node by using the following?’rabbit@COMPUTERNAME’. You need to modify the computers host file.
The host file is located on windows 2008 @?C:\Windows\System32\drivers\etc
Add the IPs and the hosts names like the follow:
10.#.#.1??HostName1
10.#.#.2 ?HostName2
After you have modified this file you should be able to cluster the two together. Log onto one of the machines and run the following commands.
rabbitmqctl stop_app
rabbitmqctl join_cluster rabbit@<MACHINENAME>
rabbitmqctl start_app
That is it the cluster is setup.
However to mirror your queues you need to add a policy which will mirror a qeue to all nodes.
rabbitmqctl set_policy mirror-all “^mirror\.” “{“”ha-mode””:””all””}”
The above will create a policy called “mirror-all” (you can call it anything you want), any queue which starts with ‘mirror’ will be mirrored to all nodes with the ha-mode policy.