
This is the RabbitMQ Server Administrator's Guide. (Note: it is still under development. Please contact us if you have any suggestions or wished-for features!)
Please see the build and installation guides for instructions on compiling, installing, starting and shutting down the server.
When the server first starts running, and detects that its database is uninitialised or has been deleted, it initialises a fresh database with the following resources:
/
/data and /admin within
the / virtual host
guest with a default password of
guest, granted full access to all realms
within the / virtual host. See here for password-changing
instructions.
rabbitmqctl is a command line tool for managing
a RabbitMQ broker. It performs all actions by connecting to
one of the broker's node. By default that is the node named
"rabbit" on the local host. This can be overridden by
explicitly specifying the node name before the command using
the "-n" flag, e.g.
rabbitmqctl -n rabbit@shortstop add_user tonyg changeit
This command instructs the RabbitMQ broker at the Erlang node rabbit@shortstop to create a user named tonyg with (initial) password changeit.
On a host named "server.example.com", the node name of the
RabbitMQ Erlang node will usually be
rabbit@server (unless 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.
rabbitmqctl stop
Stops the Erlang node on which RabbitMQ is running. To restart the node follow the instructions for Running the Server in the installation guide.
For example:
rabbitmqctl stop
This command instructs the RabbitMQ node to terminate.
rabbitmqctl 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, e.g. reset.
For example:
rabbitmqctl stop_app
This command instructs the RabbitMQ node to stop the RabbitMQ application.
rabbitmqctl start_app
Starts the RabbitMQ application.
This command is typically run after performing other
management actions that required the RabbitMQ application
to be stopped, e.g. reset.
For example:
rabbitmqctl start_app
This command instructs the RabbitMQ node to start the RabbitMQ application.
rabbitmqctl status
Displays various information about the RabbitMQ broker, such as whether the RabbitMQ application on the current node, its version number, what nodes are part of the broker, which of these are running.
For example:
rabbitmqctl status
This command displays information about the RabbitMQ broker.
rabbitmqctl reset
rabbitmqctl force_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, such as configured users, vhosts and realms, and deletes all persistent messages.
The force_reset command differs from
reset in that it resets the node
unconditionally, regardless of the current management
database state and cluster configuration. It should only
be used as a last resort if the database or cluster
configuration has been corrupted.
For reset and force_reset to
succeed the RabbitMQ application must have been stopped,
e.g. with stop_app.
For example:
rabbitmqctl reset
This command resets the RabbitMQ node.
rabbitmqctl cluster clusternode ...
Instruct the node to become member of a cluster with the specified nodes.
Cluster nodes can be of two types: disk or ram. Disk nodes replicate data in ram and on disk, thus providing redundancy in the event of node failure and recovery from global events such as power failure across all nodes. Ram nodes replicate data in ram only and are mainly used for scalability. A cluster must always have at least one disk node.
If the current node is to become a disk node it needs to appear in the cluster node list. Otherwise it becomes a ram node. If the node list is empty or only contains the current node then the node becomes a standalone, i.e. non-clustered, (disk) node.
After executing the cluster command, whenever
the RabbitMQ application is started on the current node it
will attempt to connect to the specified nodes, thus
becoming an active node in the cluster comprising those
nodes (and possibly others).
The list of nodes does not have to contain all the cluster's nodes; a subset is sufficient. Also, clustering generally succeeds as long as at least one of the specified nodes is active. Hence adjustments to the list are only necessary if the cluster configuration is to be altered radically.
For this command to succeed the RabbitMQ application must
have been stopped, e.g. with stop_app. Furthermore,
turning a standalone node into a clustered node requires
the node be reset first,
in order to avoid accidental destruction of data with the
cluster command.
For more details see the clustering guide.
Example:
rabbitmqctl cluster rabbit@tanto hare@elena
This command instructs the RabbitMQ node to join the
cluster with nodes rabbit@tanto and
hare@elena. If the node is one of these then
it becomes a disk node, otherwise a ram node.
rabbitmqctl add_user username password
For example:
rabbitmqctl add_user tonyg changeit
This command instructs the RabbitMQ broker to create a
user named tonyg with (initial) password
changeit.
rabbitmqctl delete_user username
For example:
rabbitmqctl delete_user tonyg
This command instructs the RabbitMQ broker to delete the
user named tonyg.
rabbitmqctl change_password username newpassword
For example:
rabbitmqctl change_password tonyg newpass
This command instructs the RabbitMQ broker to change the
password for the user named tonyg to
newpass.
rabbitmqctl add_vhost vhostpath
Note that the virtual host is created with the two default
realms, /data and /admin.
For example:
rabbitmqctl add_vhost test
This command instructs the RabbitMQ broker to create a new
virtual host called test, with the default
/data and /admin realms, and
with no users allowed access to the virtual host or its
realms.
rabbitmqctl delete_vhost vhostpath
Deleting a virtual host deletes all its exchanges, queues, user mappings, realms and associated permissions.
For example:
rabbitmqctl delete_vhost test
This command instructs the RabbitMQ broker to delete the
virtual host called test.
rabbitmqctl list_vhosts
For example:
rabbitmqctl list_vhosts
This command instructs the RabbitMQ broker to list all virtual hosts.
rabbitmqctl map_user_vhost username vhostpath
For example:
rabbitmqctl map_user_vhost tonyg test
This command instructs the RabbitMQ broker to grant the
user named tonyg access to the virtual host
called test.
rabbitmqctl unmap_user_vhost username vhostpath
Denying a user access to a virtual host also deletes all their permissions for realms of that virtual host.
For example:
rabbitmqctl unmap_user_vhost tonyg test
This command instructs the RabbitMQ broker to deny the
user named tonyg access to the virtual host
called test, and to remove all their
permissions for realms of that virtual host.
rabbitmqctl list_user_vhost username
For example:
rabbitmqctl list_user_vhosts tonyg
This command instructs the RabbitMQ broker to list all the
virtual hosts to which the user named tonyg
has been granted access.
rabbitmqctl list_vhost_users vhostpath
For example:
rabbitmqctl list_vhosts_user test
This command instructs the RabbitMQ broker to list all the
users which have been granted access to the virtual host
called test.
rabbitmqctl add_realm vhostpath realm
/data,
/admin etc.) to create.
For example:
rabbitmqctl add_realm test /data/test
This command instructs the RabbitMQ broker to create a new
realm named /data/test in the virtual host
called test.
rabbitmqctl delete_realm vhostpath realm
/data,
/admin etc.) to delete.
Deleting a realm deletes all associated user permissions.
For example:
rabbitmqctl delete_realm test /data/test
This command instructs the RabbitMQ broker to delete the
realm named /data/test, and its associated
user permissions, in the virtual host called
test.
rabbitmqctl list_realms vhostpath
For example:
rabbitmqctl list_realm test
This command instructs the RabbitMQ broker to list all the
realms configured for the virtual host called
test.
rabbitmqctl set_permissions username vhostpath realm [flag ...]
/data,
/admin etc.) we are to adjust the
permissions for.
passive, active,
write, read or
all. If no flags are supplied, the server
will remove all permissions for the named realm from the
named user.
Note that for this command to succeed the username must
have been granted access to the virtual host, e.g. by
using the map_user_vhost
command, and the realm must have been added to the virtual
host, e.g. by using the add_realm command.
For example:
rabbitmqctl set_permissions tonyg test /data all
This command instructs the RabbitMQ broker to allow user
tonyg full access to the /data
realm within the test virtual host.
rabbitmqctl set_permissions tonyg test /data write passive
This command instructs the RabbitMQ broker to permit
tonyg to publish messages to exchanges and to
assert the existence of previously created exchanges and
queues, but not to read from queues or create his own
queues or exchanges.
rabbitmqctl set_permissions tonyg test /data
This command instructs the RabbitMQ broker to prevent
tonyg from accessing or creating any resource
within the /data realm of the
test virtual host.
rabbitmqctl list_permissions username vhostpath
For example:
rabbitmqctl list_permissions tonyg test
This command instructs the RabbitMQ broker to list the
permissions for the user named tonyg in
realms of the virtual host called test.