1、获取invest_package_20161215.zip获取安装包;
2、新建rbmq用户;
3、解压invest_package_20161215.zip;
4、进入invest_package目录,执行:sh install.sh
5、新建vhost ot:
[rbmq@huydvm sbin]$ rabbitmqctl add_vhost ot
Creating vhost "ot" ...
6、新建用户ot,密码1:
[rbmq@huydvm sbin]$ rabbitmqctl add_user ot 1
Creating user "ot" ...
7、赋权限:
[rbmq@huydvm sbin]$ rabbitmqctl set_permissions -p ot ot '.' '.' '.*'
Setting permissions for user "ot" in vhost "ot" ...
说明:
PATH=$PATH:$HOME/.local/bin:$HOME/bini:/home/rbmq/invest_package/erlang/bin
8、添加用户时必须添加tags=management(否则,外部无法登陆该用户)
[rbmq@huydvm invest_package]$ rabbitmqctl set_user_tags ot management
Setting tags for user "ot" to [management] ...
9、使用ASF连接时报错了:
根据错误提示,用户ot访问虚拟机ot时没有权限;
10、删除一个虚拟机ot
[rbmq@huydvm invest_package]$ rabbitmqctl delete_vhost ot
Deleting vhost "ot" ...
11、删除一个用户ot
[rbmq@huydvm invest_package]$ rabbitmqctl delete_user ot
Deleting user "ot" ...
从上面执行结果可以看出,虚拟机ot和用户ot没有必然依赖关系;
12、完整命令玩法
[rbmq@huydvm invest_package]$ rabbitmqctl delete_vhost ot
Deleting vhost "ot" ...
[rbmq@huydvm invest_package]$ rabbitmqctl delete_user ot
Deleting user "ot" ...
[rbmq@huydvm invest_package]$ rabbitmqctl add_vhost fm
Creating vhost "fm" ...
[rbmq@huydvm invest_package]$ rabbitmqctl add_user ot 1
Creating user "ot" ...
[rbmq@huydvm invest_package]$ rabbitmqctl set_permissions -p fm ot '.' '.' '.*'
Setting permissions for user "ot" in vhost "fm" ...
[rbmq@huydvm invest_package]$
[rbmq@huydvm invest_package]$
[rbmq@huydvm invest_package]$
[rbmq@huydvm invest_package]$
[rbmq@huydvm invest_package]$ rabbitmqctl list_users
Listing users ...
guest [administrator]
ot []
[rbmq@huydvm invest_package]$ rabbitmqctl set_user_tags ot management
Setting tags for user "ot" to [management] ...
[rbmq@huydvm invest_package]$ rabbitmqctl list_users
Listing users ...
guest [administrator]
ot [management]
连续脚本:
rabbitmqctl add_vhost ois
rabbitmqctl add_user ois 1
rabbitmqctl set_permissions -p ois ois '.' '.' '.*'
rabbitmqctl set_user_tags ois management