概述
更多命令参考:http://www.rabbitmq.com/rabbitmqctl.8.html
一、命令格式
rabbitmqctl [ -q ] [ -l ] [ -n node ] [ -t timeout ] 命令 [ command_options ]
二、常用命令
rabbitmqctl force_reset
//Forcefully returns a RabbitMQ node to its virgin state.
rabbitmqctl reset
//Returns a RabbitMQ node to its virgin state.
rabbitmqctl shutdown
//Shuts down the Erlang process on which RabbitMQ is running. The command is blocking and will return after the Erlang process exits. If RabbitMQ fails to stop, it will return a non-zero exit code.
rabbitmqctl start_app
//Starts the RabbitMQ application.
rabbitmqctl stop_app
//Stops the RabbitMQ application, leaving the Erlang node running.
三、集群管理
命令:join_cluster clusternode [–ram]
rabbitmqctl join_cluster hare@elena --ram //this command instructs the RabbitMQ node to join the cluster that “hare@elena” is part of, 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:The type must be one of the following:disc ram rabbitmqctl -n hare@mcnulty forget_cluster_node rabbit@stringer //this command will remove the node “rabbit@stringer” from the node “hare@mcnulty”: rabbitmqctl rename_cluster_node rabbit@misshelpful rabbit@cordelia //this command will rename the node “rabbit@misshelpful” to the node “rabbit@cordelia” rabbitmqctl force_boot // this will force the node not to wait for other nodes next time it is started: purge_queue [-p vhost] queue //removes all messages in it rabbitmqctl set_cluster_name london //this sets the cluster name to “london”:
四、用户管理
rabbitmqctl add_user tonyg changeit
// this command instructs the RabbitMQ broker to create a (non-administrative) user named “tonyg” with (initial) password “changeit”:
rabbitmqctl delete_user tonyg
//this command instructs the RabbitMQ broker to delete the user named “tonyg”:
rabbitmqctl change_password tonyg newpass
//this command instructs the RabbitMQ broker to change the password for the user named “tonyg” to “newpass”:
rabbitmqctl clear_password tonyg
//this command instructs the RabbitMQ broker to clear the password for the user named “tonyg”:
rabbitmqctl authenticate_user tonyg verifyit // this command instructs the RabbitMQ broker to authenticate the user named “tonyg” with password “verifyit”:
rabbitmqctl set_user_tags tonyg administrator
//this command instructs the RabbitMQ broker to ensure the user named “tonyg” is an administrator:
rabbitmqctl set_user_tags tonyg
//This command instructs the RabbitMQ broker to remove any tags from the user named “tonyg”:
rabbitmqctl list_users
//this command instructs the RabbitMQ broker to list all users:
五、访问控制
rabbitmqctl add_vhost test //his command instructs the RabbitMQ broker to create a new virtual host called “test”:
rabbitmqctl delete_vhost test
//this command instructs the RabbitMQ broker to delete the virtual host called “test”:
rabbitmqctl list_vhosts name tracing
//this command instructs the RabbitMQ broker to list all virtual hosts:
rabbitmqctl set_permissions -p /myvhost tonyg “^tonyg-.*” “.*” “.*”
//this command instructs the RabbitMQ broker to grant the user named “tonyg” access to the virtual host called “/myvhost”, with configure permissions on all resources whose names starts with “tonyg-”, and write and read permissions on all resources:
rabbitmqctl clear_permissions -p /myvhost tonyg
//this command instructs the RabbitMQ broker to deny the user named “tonyg” access to the virtual host called “/myvhost”:
rabbitmqctl list_permissions -p /myvhost
// this command instructs the RabbitMQ broker to list all the users which have been granted access to the virtual host called “/myvhost”, and the permissions they have for operations on resources in that virtual host. Note that an empty string means no permissions granted:
rabbitmqctl list_user_permissions tonyg
//this command instructs the RabbitMQ broker to list all the virtual hosts to which the user named “tonyg” has been granted access, and the permissions the user has for operations on resources in these virtual hosts:
rabbitmqctl set_topic_permissions -p /myvhost tonyg amq.topic “^tonyg-.*” “^tonyg-.*”
//this command instructs the RabbitMQ broker to let the user named “tonyg” publish and consume messages going through the “amp.topic” exchange of the “/myvhost” virtual host with a routing key starting with “tonyg-”:
//Topic permissions support variable expansion for the following variables: username, vhost, and client_id. Note that client_id is expanded only when using MQTT. The previous example could be made more generic by using “^{username}-.*”:
rabbitmqctl set_topic_permissions -p /myvhost tonyg amq.topic “^{username}-.*” “^{username}-.*”
rabbitmqctl clear_topic_permissions -p /myvhost tonyg amq.topic
//this command instructs the RabbitMQ broker to remove topic permissions for user named “tonyg” for the topic exchange “amq.topic” in the virtual host called “/myvhost”:
rabbitmqctl list_topic_permissions -p /myvhost
//this command instructs the RabbitMQ broker to list all the users which have been granted topic permissions in the virtual host called “/myvhost:”
rabbitmqctl list_topic_user_permissions tonyg
// this command instructs the RabbitMQ broker to list all the virtual hosts to which the user named “tonyg” has been granted access, and the topic permissions the user has in these virtual hosts:
六、参数管理
Parameter Management
【第三方插件比较多】
七、政策管理
对queue的全局设置用的上这个“政策“,
队列的镜像也是用这个命令。
八、服务器状态
《1》 list_queues [-p vhost] [queueinfoitem …]
rabbitmqctl list_queues name durable exclusive
《2》 list_exchanges [-p vhost] [exchangeinfoitem …]
《3》 list_bindings [-p vhost] [bindinginfoitem …]
《4》 list_connections [connectioninfoitem …]
《5》 list_channels [channelinfoitem …]
connections =》 channels
建立connections是长连接 ,channels是挂在connection之上的。。
《6》 status
《7》 environment
《8》 Miscellaneous 【混合一些命令】
最后
以上就是积极小伙为你收集整理的rabbitmqctl 用于管理RabbitMQ代理的命令行的全部内容,希望文章能够帮你解决rabbitmqctl 用于管理RabbitMQ代理的命令行所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复