288
288
<title>Cluster management</title>
291
<varlistentry id="cluster">
292
<term><cmdsynopsis><command>cluster</command> <arg choice="req" role="usage-option-list"><replaceable>clusternode</replaceable> ...</arg></cmdsynopsis></term>
291
<varlistentry id="join_cluster">
292
<term><cmdsynopsis><command>join_cluster</command> <arg choice="req"><replaceable>clusternode</replaceable></arg><arg choice="opt"><replaceable>--ram</replaceable></arg></cmdsynopsis></term>
296
296
<term>clusternode</term>
297
<listitem><para>Subset of the nodes of the cluster to which this node should be connected.</para></listitem>
297
<listitem><para>Node to cluster with.</para></listitem>
300
<term><cmdsynopsis><arg choice="opt">--ram</arg></cmdsynopsis></term>
303
If provided, the node will join the cluster as a RAM node.
301
Instruct the node to become member of a cluster with the
302
specified nodes. To cluster with currently offline nodes,
303
use <link linkend="force_cluster"><command>force_cluster</command></link>.
306
Cluster nodes can be of two types: disk or ram. Disk nodes
307
replicate data in ram and on disk, thus providing
308
redundancy in the event of node failure and recovery from
309
global events such as power failure across all nodes. Ram
310
nodes replicate data in ram only and are mainly used for
311
scalability. A cluster must always have at least one disk node.
314
If the current node is to become a disk node it needs to
315
appear in the cluster node list. Otherwise it becomes a
316
ram node. If the node list is empty or only contains the
317
current node then the node becomes a standalone,
318
i.e. non-clustered, (disk) node.
309
Instruct the node to become a member of the cluster that the
310
specified node is in. Before clustering, the node is reset, so be
311
careful when using this command. For this command to succeed the
312
RabbitMQ application must have been stopped, e.g. with <link
313
linkend="stop_app"><command>stop_app</command></link>.
316
Cluster nodes can be of two types: disc or RAM. Disc nodes
317
replicate data in RAM and on disc, thus providing redundancy in
318
the event of node failure and recovery from global events such
319
as power failure across all nodes. RAM nodes replicate data in
320
RAM only (with the exception of queue contents, which can reside
321
on disc if the queue is persistent or too big to fit in memory)
322
and are mainly used for scalability. RAM nodes are more
323
performant only when managing resources (e.g. adding/removing
324
queues, exchanges, or bindings). A cluster must always have at
325
least one disc node, and usually should have more than one.
328
The node will be a disc node by default. If you wish to
329
create a RAM node, provide the <command>--ram</command> flag.
321
332
After executing the <command>cluster</command> command, whenever
322
the RabbitMQ application is started on the current node it
323
will attempt to connect to the specified nodes, thus
324
becoming an active node in the cluster comprising those
325
nodes (and possibly others).
328
The list of nodes does not have to contain all the
329
cluster's nodes; a subset is sufficient. Also, clustering
330
generally succeeds as long as at least one of the
331
specified nodes is active. Hence adjustments to the list
332
are only necessary if the cluster configuration is to be
336
For this command to succeed the RabbitMQ application must
337
have been stopped, e.g. with <link linkend="stop_app"><command>stop_app</command></link>. Furthermore,
338
turning a standalone node into a clustered node requires
339
the node be <link linkend="reset"><command>reset</command></link> first,
340
in order to avoid accidental destruction of data with the
341
<command>cluster</command> command.
344
For more details see the <ulink url="http://www.rabbitmq.com/clustering.html">clustering guide</ulink>.
333
the RabbitMQ application is started on the current node it will
334
attempt to connect to the nodes that were in the cluster when the
338
To leave a cluster, <command>reset</command> the node. You can
339
also remove nodes remotely with the
340
<command>forget_cluster_node</command> command.
343
For more details see the <ulink
344
url="http://www.rabbitmq.com/clustering.html">clustering
346
347
<para role="example-prefix">For example:</para>
347
<screen role="example">rabbitmqctl cluster rabbit@tanto hare@elena</screen>
348
<screen role="example">rabbitmqctl join_cluster hare@elena --ram</screen>
348
349
<para role="example">
349
This command instructs the RabbitMQ node to join the
350
cluster with nodes <command>rabbit@tanto</command> and
351
<command>hare@elena</command>. If the node is one of these then
352
it becomes a disk node, otherwise a ram node.
356
<varlistentry id="force_cluster">
357
<term><cmdsynopsis><command>force_cluster</command> <arg choice="req" role="usage-option-list"><replaceable>clusternode</replaceable> ...</arg></cmdsynopsis></term>
361
<term>clusternode</term>
362
<listitem><para>Subset of the nodes of the cluster to which this node should be connected.</para></listitem>
366
Instruct the node to become member of a cluster with the
367
specified nodes. This will succeed even if the specified nodes
368
are offline. For a more detailed description, see
369
<link linkend="cluster"><command>cluster</command>.</link>
372
Note that this variant of the cluster command just
373
ignores the current status of the specified nodes.
374
Clustering may still fail for a variety of other
350
This command instructs the RabbitMQ node to join the cluster that
351
<command>hare@elena</command> is part of, as a ram node.
370
<term><cmdsynopsis><command>change_cluster_node_type</command> <arg choice="req">disc | ram</arg></cmdsynopsis>
374
Changes the type of the cluster node. The node must be stopped for
375
this operation to succeed, and when turning a node into a RAM node
376
the node must not be the only disc node in the cluster.
378
<para role="example-prefix">For example:</para>
379
<screen role="example">rabbitmqctl change_cluster_node_type disc</screen>
380
<para role="example">
381
This command will turn a RAM node into a disc node.
386
<term><cmdsynopsis><command>forget_cluster_node</command> <arg choice="opt">--offline</arg></cmdsynopsis></term>
390
<term><cmdsynopsis><arg choice="opt">--offline</arg></cmdsynopsis></term>
393
Enables node removal from an offline node. This is only
394
useful in the situation where all the nodes are offline and
395
the last node to go down cannot be brought online, thus
396
preventing the whole cluster from starting. It should not be
397
used in any other circumstances since it can lead to
404
Removes a cluster node remotely. The node that is being removed
405
must be offline, while the node we are removing from must be
406
online, except when using the <command>--offline</command> flag.
408
<para role="example-prefix">For example:</para>
409
<screen role="example">rabbitmqctl -n hare@mcnulty forget_cluster_node rabbit@stringer</screen>
410
<para role="example">
411
This command will remove the node
412
<command>rabbit@stringer</command> from the node
413
<command>hare@mcnulty</command>.
418
<term><cmdsynopsis><command>update_cluster_nodes</command> <arg choice="req">clusternode</arg></cmdsynopsis>
423
<term>clusternode</term>
426
The node to consult for up to date information.
432
Instructs an already clustered node to contact
433
<command>clusternode</command> to cluster when waking up. This is
434
different from <command>join_cluster</command> since it does not
435
join any cluster - it checks that the node is already in a cluster
436
with <command>clusternode</command>.
439
The need for this command is motivated by the fact that clusters
440
can change while a node is offline. Consider the situation in
441
which node A and B are clustered. A goes down, C clusters with B,
442
and then B leaves the cluster. When A wakes up, it'll try to
443
contact B, but this will fail since B is not in the cluster
444
anymore. <command>update_cluster_nodes -n A C</command> will solve
804
<title>Parameter Management</title>
806
Certain features of RabbitMQ (such as the federation plugin)
807
are controlled by dynamic,
808
cluster-wide <emphasis>parameters</emphasis>. Each parameter
809
consists of a component name, a name and a value, and is
810
associated with a virtual host. The component name and name are
811
strings, and the value is an Erlang term. Parameters can be
812
set, cleared and listed. In general you should refer to the
813
documentation for the feature in question to see how to set
818
<term><cmdsynopsis><command>set_parameter</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="req"><replaceable>component_name</replaceable></arg> <arg choice="req"><replaceable>name</replaceable></arg> <arg choice="req"><replaceable>value</replaceable></arg></cmdsynopsis></term>
825
<term>component_name</term>
827
The name of the component for which the
828
parameter is being set.
834
The name of the parameter being set.
840
The value for the parameter, as a
841
JSON term. In most shells you are very likely to
846
<para role="example-prefix">For example:</para>
847
<screen role="example">rabbitmqctl set_parameter federation local_username '"guest"'</screen>
848
<para role="example">
849
This command sets the parameter <command>local_username</command> for the <command>federation</command> component in the default virtual host to the JSON term <command>"guest"</command>.
854
<term><cmdsynopsis><command>clear_parameter</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="req"><replaceable>component_name</replaceable></arg> <arg choice="req"><replaceable>key</replaceable></arg></cmdsynopsis></term>
861
<term>component_name</term>
863
The name of the component for which the
864
parameter is being cleared.
870
The name of the parameter being cleared.
874
<para role="example-prefix">For example:</para>
875
<screen role="example">rabbitmqctl clear_parameter federation local_username</screen>
876
<para role="example">
877
This command clears the parameter <command>local_username</command> for the <command>federation</command> component in the default virtual host.
882
<term><cmdsynopsis><command>list_parameters</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg></cmdsynopsis></term>
885
Lists all parameters for a virtual host.
887
<para role="example-prefix">For example:</para>
888
<screen role="example">rabbitmqctl list_parameters</screen>
889
<para role="example">
890
This command lists all parameters in the default virtual host.
898
<title>Policy Management</title>
900
Policies are used to control and modify the behaviour of queues
901
and exchanges on a cluster-wide basis. Policies apply within a
902
given vhost, and consist of a name, pattern, definition and an
903
optional priority. Policies can be set, cleared and listed.
907
<term><cmdsynopsis><command>set_policy</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="req"><replaceable>name</replaceable></arg> <arg choice="req"><replaceable>pattern</replaceable></arg> <arg choice="req"><replaceable>definition</replaceable></arg> <arg choice="opt"><replaceable>priority</replaceable></arg> </cmdsynopsis></term>
916
The name of the policy.
922
The regular expression, which when matches on a given resources causes the policy to apply.
926
<term>definition</term>
928
The definition of the policy, as a
929
JSON term. In most shells you are very likely to
934
<term>priority</term>
936
The priority of the policy as an integer, defaulting to 0. Higher numbers indicate greater precedence.
940
<para role="example-prefix">For example:</para>
941
<screen role="example">rabbitmqctl set_policy federate-me "^amq." '{"federation-upstream-set":"all"}'</screen>
942
<para role="example">
943
This command sets the policy <command>federate-me</command> in the default virtual host so that built-in exchanges are federated.
948
<term><cmdsynopsis><command>clear_policy</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="req"><replaceable>name</replaceable></arg></cmdsynopsis></term>
957
The name of the policy being cleared.
961
<para role="example-prefix">For example:</para>
962
<screen role="example">rabbitmqctl clear_policy federate-me</screen>
963
<para role="example">
964
This command clears the <command>federate-me</command> policy in the default virtual host.
969
<term><cmdsynopsis><command>list_policies</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg></cmdsynopsis></term>
972
Lists all policies for a virtual host.
974
<para role="example-prefix">For example:</para>
975
<screen role="example">rabbitmqctl list_policies</screen>
976
<para role="example">
977
This command lists all policies in the default virtual host.
748
985
<title>Server Status</title>
750
987
The server status queries interrogate the server and return a list of
832
1073
<listitem><para>Number of consumers.</para></listitem>
1076
<term>active_consumers</term>
1079
Number of active consumers. An active consumer is
1080
one which could immediately receive any messages
1081
sent to the queue - i.e. it is not limited by its
1082
prefetch count, TCP congestion, flow control, or
1083
because it has issued channel.flow. At least one
1084
of messages_ready and active_consumers must always
1088
Note that this value is an instantaneous snapshot
1089
- when consumers are restricted by their prefetch
1090
count they may only appear to be active for small
1091
fractions of a second until more messages are sent
835
1097
<term>memory</term>
836
1098
<listitem><para>Bytes of memory consumed by the Erlang process associated with the
837
1099
queue, including stack, heap and internal structures.</para></listitem>