赞
踩
继上文根据rabbitMQ官网文档,在linux下安装了rabbitMQ,同时,装了第三方可视化界面管理插件。因此,我们使用命令和可视化界面进行VirtualHost与权限的添加。
网上解释的很多,但是我根据个人理解,简单易懂点理解,就相当于mysql的DB数据库。如:创建一个用户User库。在这个库里exchange、queue等是相互通用,不同的库是不共用的。
[root@localhost ~]# rabbitmqctl add_user admin admin
备注:rabbitmqctl add_user 登录的账号 登录账号的密码
2.配置角色
[root@localhost ~]# rabbitmqctl set_user_tags admin administrator
备注:rabbitmqctl set_user_tags 登录的账号 权限级别
3.添加一个virtualHost
[root@localhost ~]# rabbitmqctl add_vhost /admin
备注:
rabbitmqctl add_vhost /virtualHost
4.配置权限
[root@localhost ~]# rabbitmqctl set_permissions -p /admin superrd ".*" ".*" ".*"
备注:rabbitmqctl set_permissions -p /virtualHost superrd “." ".” “.*”
management
User can access the management plugin
policymaker
User can access the management plugin and manage policies and parameters for the vhosts they have access to.
monitoring
User can access the management plugin and see all connections and channels as well as node-related information.
administrator
User can do everything monitoring can do, manage users, vhosts and permissions, close other user’s connections, and manage policies and parameters for all vhosts.
针对上面加粗的地方,需要根据自己需要设置相应的账号和权限。virtualHost最好与账号同名,它的格式是按照正则匹配的。如:/ , /admin /test
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。