
The XML root element of Docbook XML files should match the following format: <ELEMENT xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="THE_XML_ID_OF_THE_ELEMENT"> Change-Id: I47786e5f70b64e1b14d1015ec5613a538ef8fc52
43 lines
2.7 KiB
XML
43 lines
2.7 KiB
XML
<section xmlns="http://docbook.org/ns/docbook"
|
||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||
version="5.0"
|
||
xml:id="_configure_rabbitmq">
|
||
|
||
<title>Configure RabbitMQ</title>
|
||
|
||
<para>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.</para>
|
||
<para>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):</para>
|
||
<screen><prompt>#</prompt> <userinput>scp /var/lib/rabbitmq/.erlang.cookie \
|
||
root@rabbit2:/var/lib/rabbitmq/.erlang.cookie</userinput></screen>
|
||
<para>Then, start RabbitMQ on nodes.
|
||
If RabbitMQ fails to start, you can’t continue to the next step.</para>
|
||
<para>Now, we are building the HA cluster. From rabbit2, run these commands:</para>
|
||
<screen><prompt>#</prompt> <userinput>rabbitmqctl stop_app</userinput>
|
||
<prompt>#</prompt> <userinput>rabbitmqctl join_cluster rabbit@rabbit1</userinput>
|
||
<prompt>#</prompt> <userinput>rabbitmqctl start_app</userinput></screen>
|
||
<para>To verify the cluster status:</para>
|
||
<screen><prompt>#</prompt> <userinput>rabbitmqctl cluster_status</userinput>
|
||
<computeroutput>
|
||
Cluster status of node rabbit@rabbit2 ...
|
||
[{nodes,[{disc,[rabbit@rabbit1]},{ram,[rabbit@rabbit2]}]},{running_nodes,[rabbit@rabbit2,rabbit@rabbit1]}]
|
||
</computeroutput></screen>
|
||
<para>If the cluster is working, you can now proceed to creating users and passwords for queues.</para>
|
||
<para>
|
||
<emphasis role="strong">Note for RabbitMQ version 3</emphasis>
|
||
</para>
|
||
<para>Queue mirroring is no longer controlled by the <emphasis>x-ha-policy</emphasis> 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:</para>
|
||
<screen><prompt>#</prompt> <userinput>rabbitmqctl set_policy HA '^(?!amq\.).*' '{"ha-mode": "all"}'</userinput></screen>
|
||
<para>
|
||
<link xlink:href="http://www.rabbitmq.com/ha.html">More information about High availability in RabbitMQ</link>
|
||
</para>
|
||
</section>
|