rabbitmqctl - command line tool for managing a RabbitMQ broker

SYNOPSIS

rabbitmqctl [-n node] [-q] {command} [command options…]

DESCRIPTION

RabbitMQ is an implementation of AMQP, the emerging standard for high performance enterprise messaging. The RabbitMQ server is a robust and scalable implementation of an AMQP broker.

rabbitmqctl is a command line tool for managing a RabbitMQ broker. It performs all actions by connecting to one of the broker’s nodes.

Diagnostic information is displayed if the broker was not running, could not be reached, or rejected the connection due to mismatching Erlang cookies.

OPTIONS

[-n node] Default node is “rabbit@server”, where server is the local host. On a host named “server.example.com”, the node name of the RabbitMQ Erlang node will usually be rabbit@server (unless RABBITMQ_NODENAME has been set to some non-default value at broker startup time). The output of hostname -s is usually the correct suffix to use after the “@” sign. See rabbitmq-server(1) for details of configuring the RabbitMQ broker.

[-q] Quiet output mode is selected with the “-q” flag. Informational messages are suppressed when quiet mode is in effect.

COMMANDS

Application and Cluster Management

stop [pid_file]

  • Stops the Erlang node on which RabbitMQ is running. To restart the node follow the instructions for Running the Server in the installation guide.
  • If a pid_file is specified, also waits for the process specified there to terminate.

stop_app

  • Stops the RabbitMQ application, leaving the Erlang node running.
  • This command is typically run prior to performing other management actions that require the RabbitMQ application to be stopped.

start_app

  • Starts the RabbitMQ application.
  • This command is typically run after performing other management actions that required the RabbitMQ application to be stopped.

wait {pid_file}

  • Wait for the RabbitMQ application to start.
  • This command will wait for the RabbitMQ application to start at the node.

reset

  • Return a RabbitMQ node to its virgin state.
  • Removes the node from any cluster it belongs to, removes all data from the management database.

force_reset

  • Forcefully return a RabbitMQ node to its virgin state.
  • The force_reset command differs from reset in that it resets the node unconditionally.

rotate_logs {suffix}

  • Instruct the RabbitMQ node to rotate the log files.

Cluster Management

join_cluster {clusternode} [–ram]

  • Instruct the node to become a member of the cluster that the specified node is in.
  • The node will be a disc node by default. Use –ram for RAM node.

cluster_status

  • Displays all the nodes in the cluster grouped by node type.

change_cluster_node_type {disc | ram}

  • Changes the type of the cluster node.

forget_cluster_node [–offline]

  • Removes a cluster node remotely.

update_cluster_nodes {clusternode}

  • Instructs an already clustered node to contact clusternode to cluster when waking up.

sync_queue {queue}

  • Instructs a mirrored queue with unsynchronised slaves to synchronise itself.

cancel_sync_queue {queue}

  • Instructs a synchronising mirrored queue to stop synchronising itself.

User Management

add_user {username} {password}

  • Creates a new user with the specified username and password.

delete_user {username}

  • Deletes the specified user.

change_password {username} {newpassword}

  • Changes the password for the specified user.

clear_password {username}

  • Clears the password for the specified user.

set_user_tags {username} {tag …}

  • Sets user tags for the specified user.

list_users

  • Lists all users and their tags.

Access Control

add_vhost {vhostpath}

  • Creates a new virtual host.

delete_vhost {vhostpath}

  • Deletes a virtual host.

list_vhosts [vhostinfoitem …]

  • Lists virtual hosts.

set_permissions [-p vhostpath] {user} {conf} {write} {read}

  • Sets user permissions for a virtual host.

clear_permissions [-p vhostpath] {username}

  • Clears user permissions for a virtual host.

list_permissions [-p vhostpath]

  • Lists permissions in a virtual host.

list_user_permissions {username}

  • Lists permissions for a specific user.

Parameter Management

set_parameter [-p vhostpath] {component_name} {name} {value}

  • Sets a parameter.

clear_parameter [-p vhostpath] {component_name} {key}

  • Clears a parameter.

list_parameters [-p vhostpath]

  • Lists all parameters for a virtual host.

Policy Management

set_policy [-p vhostpath] [–priority priority] [–apply-to apply-to] {name} {pattern} {definition}

  • Sets a policy.

clear_policy [-p vhostpath] {name}

  • Clears a policy.

list_policies [-p vhostpath]

  • Lists all policies for a virtual host.

Server Status

list_queues [-p vhostpath] [queueinfoitem …]

  • Returns queue details.

list_exchanges [-p vhostpath] [exchangeinfoitem …]

  • Returns exchange details.

list_bindings [-p vhostpath] [bindinginfoitem …]

  • Returns binding details.

list_connections [connectioninfoitem …]

  • Returns TCP/IP connection statistics.

list_channels [channelinfoitem …]

  • Returns information on all current channels.

list_consumers [-p vhostpath]

  • Lists consumers.

status

  • Displays broker status information.

environment

  • Display application environment variables.

report

  • Generate a server status report.

eval {expr}

  • Evaluate an arbitrary Erlang expression.

Miscellaneous

close_connection {connectionpid} {explanation}

  • Instruct the broker to close the specified connection.

trace_on [-p vhost]

  • Starts tracing.

trace_off [-p vhost]

  • Stops tracing.

set_vm_memory_high_watermark {fraction}

  • Sets the memory threshold for flow control.

EXAMPLES

rabbitmqctl stop

  • This command instructs the RabbitMQ node to terminate.

rabbitmqctl stop_app

  • This command instructs the RabbitMQ node to stop the RabbitMQ application.

rabbitmqctl start_app

  • This command instructs the RabbitMQ node to start the RabbitMQ application.

rabbitmqctl wait /var/run/rabbitmq/pid

  • This command will return when the RabbitMQ node has started up.

rabbitmqctl reset

  • This command resets the RabbitMQ node.

rabbitmqctl force_reset

  • This command resets the RabbitMQ node.

rabbitmqctl rotate_logs .1

  • This command rotates log files with “.1” suffix.

rabbitmqctl join_cluster hare@elena –ram

  • This command joins the cluster as a RAM node.

rabbitmqctl cluster_status

  • This command displays the nodes in the cluster.

rabbitmqctl change_cluster_node_type disc

  • This command will turn a RAM node into a disc node.

rabbitmqctl add_user tonyg changeit

  • This command creates a new user “tonyg” with password “changeit”.

rabbitmqctl delete_user tonyg

  • This command deletes the user “tonyg”.

rabbitmqctl set_permissions -p /myvhost tonyg “^tonyg-.” “.” “.*”

  • This command sets permissions for user “tonyg” in vhost “/myvhost”.

rabbitmqctl list_queues -p /myvhost messages consumers

  • This command displays queue depth and consumer count.

rabbitmqctl list_exchanges -p /myvhost name type

  • This command displays exchange names and types.

rabbitmqctl status

  • This command displays broker status information.

AUTHOR

The RabbitMQ Team «[email protected]»

NOTES

  1. Installation guide: http://www.rabbitmq.com/install.html
  2. Clustering guide: http://www.rabbitmq.com/clustering.html