rabbitmq管理指南

用户管理
1.添加用户
# rabbitmqctl add_user username password
2.删除用户
# rabbitmqctl delete_user username
3.修改密码
# rabbitmqctl change_password username newpassword
4.列出所有用户
# rabbitmqctl list_users

权限控制 1.创建虚拟主机
# rabbitmqctl add_vhost vhostpath
2.删除虚拟主机
# rabbitmqctl delete_vhost vhostpath
3.列出所有虚拟主机
# rabbitmqctl list_vhosts
4.设置用户权限
# rabbitmqctl set_permissions [-p vhostpath] username regexp regexp regexp
5.清除用户权限
# rabbitmqctl clear_permissions [-p vhostpath] username
6.列出虚拟主机上的所有权限
# rabbitmqctl list_permissions [-p vhostpath]
7.列出用户权限

# rabbitmqctl list_user_permissions username

例子:

添加  rabbitmqctl add_vhost az

rabbitmqctl set_permissions -p az guest ".*" ".*" ".*"

#--------------------------------------------------------------------------
rabbitmqctl add_user rmq 123456

rabbitmqctl set_admin rmq

rabbitmqctl delete_user guest

rabbitmqctl add_vhost MailChangeHost

rabbitmqctl list_vhosts

rabbitmqctl set_permissions -p "/" rmq ".*" ".*" ".*"

rabbitmqctl set_permissions -p "MailChangeHost" rmq ".*" ".*" ".*"

rabbitmqctl list_permissions
rabbitmqctl list_user_permissions rmq
rabbitmqctl list_permissions -p MailChangeHost
rabbitmqctl list_queues -p MailChangeHost
rabbitmqctl list_exchanges -p MailChangeHost


rabbitmqctl clear_permissions -p MailChangeHost rmq
rabbitmqctl delete_vhost MailChangeHost

#--------------------------------------------------
rabbitmqctl add_user rmq 123456
rabbitmqctl set_admin rmq
rabbitmqctl delete_user guest
rabbitmqctl set_permissions -p "/" rmq ".*" ".*" ".*"

rabbitmqctl add_vhost MailChangeHost
rabbitmqctl set_permissions -p "MailChangeHost" rmq ".*" ".*" ".*"

rabbitmqctl add_vhost NewMailHost
rabbitmqctl set_permissions -p "NewMailHost" rmq ".*" ".*" ".*"

#---------------------------------------------------
rabbitmqctl clear_permissions -p MailChangeHost rmq
rabbitmqctl clear_permissions -p NewMailHost rmq
rabbitmqctl delete_vhost MailChangeHost
rabbitmqctl delete_vhost NewMailHost

rabbitmqctl list_queues -p NewMailHost
rabbitmqctl list_queues -p MailChangeHost

你可能感兴趣的:(rabbitmq)