Learning RABBITMQ, the first thing to master after the principle is rabbitmqctl the use of the command, RABBITMQ the most comprehensive management function is the RABBITMQCTL command, of course, there are HTTP API and UI two kinds of management tools.
How to use Rabbitmqctl:
Rabbitmqctl [-n <node>] [-Q] <command> [<command options>] -N node Default node name is "[email Protected] ", if your host is ' server.example.com ', then node name is ' [email protected] '. -Q Quiet output mode, information will be suppressed output
Commands:
Basic management functions
Stop [<pid_file>] #stopping the RABBITMQ running on Erlang node causes RABBITMQ to stopStop_app#Stop the application of RABBITMQ on Erlang node, but Erlang node will continue to runStart_app#start the application of the RABBITMQ on Erlan nodeWait <pid_file>#wait for the RABBITMQ service to startReset #initializes the node state, removes it from the cluster, removes all data from the management database, such as vhosts, and so on. The RABBITMQ application must be stopped before initializationForce_reset#unconditional initialization of node StateRotate_logs <suffix>#Rotate log file
Cluster Management
Join_cluster <clusternode> [--RAM]#Clusternode represents the node name, and--ram indicates that node joins the cluster with Ram node. The default node joins the cluster with disc node, and before a node joins cluster, it must first stop the node's RABBITMQ application, which is to execute Stop_app first. Cluster_status#Show all node in clusterChange_cluster_node_type Disc |Ram#Change the mode of node in a cluster, the node must stop before the conversion, cannot convert the unique disk node in a cluster into RAM nodeForget_cluster_node [--Offline]#remotely removes a node in the cluster, provided that the node must be in the offline state, and if it is online, it needs to add the--offline parameter. update_cluster_nodes Clusternode#sync_queue Queue#synchronizing a mirrored queuecancel_sync_queue Queue#
User Management
Add_user <username> <password>#adding users to the RABBITMQ internal DatabaseDelete_user <username>#Delete a userChange_password <username> <newpassword>#change user password \ \ Change Web Admin login PasswordClear_password <username>#Clear user password, prevent user from logging inSet_user_tags <username> <tag> ...#Set User Tagslist_users#List UsersAdd_vhost <vhostpath>#Create a vhostsDelete_vhost <vhostpath>#Delete a vhostsList_vhosts [<vhostinfoitem> ...] #List vhostsset_permissions [-P <vhostpath>] <user> <conf> <write> <read>#Assigning permissions to a user for a vhostsclear_permissions [-P <vhostpath>] <username>#clear a user's permissions to vhostslist_permissions [-P <vhostpath>] #lists which users have access to the vhostsList_user_permissions <username>#list the user's access rightsSet_parameter [-P <vhostpath>] <component_name> <name> <value>#Clear_parameter [-P <vhostpath>] <component_name> <Key>#list_parameters [-P <vhostpath>] #
policy management, policies used to control and modify queues and exchange behavior in the cluster, policies can be applied to vhost
Set_policy [-P <vhostpath>] [--priority <priority>] [--apply-to<apply-to> ]<name > <pattern> <definition> #namepolicy name, pattern regular expression, used to match the resource, the policy of the setting is applied, Apply-to indicates what type of policy is applied to, typically queues, exchange, and all, which is all by default. Priority is an integer precedence, and definition is a policy set in JSON format. Clear_policy [-P <vhostpath>] <name> # clear a policy list_policies [-P <vhostpath >] # List existing policies
Queues && Exchange status information
list_queues [-P <vhostpath>] [<queueinfoitem> ...] #returns information for the queue, and if the-p parameter is omitted, the "/" vhosts information is displayed by default. list_exchanges [-P <vhostpath>] [<exchangeinfoitem> ...] #returns information for Exchange. list_bindings [-P <vhostpath>] [<bindinginfoitem> ...] #returns the binding information. List_connections [<connectioninfoitem> ...] #returns the link information. List_channels [<channelinfoitem> ...] #returns all the current channels. list_consumers [-P <vhostpath>] #return to consumers,Status#Show the status of the brokerEnvironment#display information about the environment parameters Report#Returns a service status report,Eval<expr>
RABBITMQ supports various plugins, enabling plugins to use the Rabbitmq-plugins command
Plug-in opening and closing methods
Rabbitmq-plugins <command> [<command options>]commands: list [-v] [-m] [-e] [-e] [ <pattern>] displays all of the plugins. -V Display version-m display name-e display explicitly turned on-E. Show clear and secretly open <plugin> ... Open a plugin <plugin> ... Close a plugin
Plug-in general installation path under Debian/ubuntu:/usr/lib/rabbitmq/lib/rabbitmq_server-3.2.2/plugins
Open: Rabbitmq-plugins enable Rabbitmq_management
Rabbitmq_management provides an HTTP-based API interface to manage and monitor your RABBITMQ. He has the web way and the CLI way, in fact the web way is to call the HTTP API on the back end
rabbitmq_management Plug-in usage:
Web http:/// host:15672/API http://host:15672/api/CLI http:// HOST:15672/CLI
Common commands for Rabbitmqctl in RABBITMQ