Atom feed of this document
  
 

 Configure RabbitMQ

Here we are building a cluster of RabbitMQ nodes to construct a RabbitMQ broker. Mirrored queues in RabbitMQ improve the availability of service since it will be resilient to failures. We have to consider that while exchanges and bindings will survive the loss of individual nodes, queues and their messages will not because a queue and its contents is located on one node. If we lose this node, we also lose the queue.

We consider that we run (at least) two RabbitMQ servers. To build a broker, we need to ensure that all nodes have the same erlang cookie file. To do so, stop RabbitMQ everywhere and copy the cookie from rabbit1 server to other server(s):

scp /var/lib/rabbitmq/.erlang.cookie \
root@rabbit2:/var/lib/rabbitmq/.erlang.cookie

Then, start RabbitMQ on nodes. If RabbitMQ fails to start, you can’t continue to the next step.

Now, we are building the HA cluster. From rabbit2, run these commands:

rabbitmqctl stop_app
rabbitmqctl cluster rabbit@rabbit1
rabbitmqctl start_app

To verify the cluster status :

rabbitmqctl cluster_status

Cluster status of node rabbit@rabbit2 ...
[{nodes,[{disc,[rabbit@rabbit1]},{ram,[rabbit@rabbit2]}]},{running_nodes,[rabbit@rabbit2,rabbit@rabbit1]}]

If the cluster is working, you can now proceed to creating users and passwords for queues.

Note for RabbitMQ version 3

Queue mirroring is no longer controlled by the x-ha-policy argument when declaring a queue. OpenStack can continue to declare this argument, but it won’t cause queues to be mirrored. We need to make sure that all queues (except those with auto-generated names) are mirrored across all running nodes:

rabbitmqctl set_policy HA '^(?!amq\.).*' '{"ha-mode": "all"}'

More information about High availability in RabbitMQ

Questions? Discuss on ask.openstack.org
Found an error? Report a bug against this page

loading table of contents...