II RabbitMQ User Management, Role Management and Permission Setting
Because RabbitMQ is installed using docker, you need to enter RabbitMQ in the docker environment first.
1 | Enter the docker environment |
一 user management
View User List
1
rabbitmqctl list_users
New User
1
rabbitmqctl add_user developer 456789
delete user
1
rabbitmqctl delete_user developer
chagne password
1
rabbitmqctl change_password developer developer123456
二 characterization
In RabbitMQ, there are several roles: administrator, monitoring, policymaker, management, impersonator, and none.
The default user guest is in the administrator role, and the new developer user has no role set, i.e., none, if we want to set the developer user to the administrator role
1
rabbitmqctl set_user_tags developer administrator
It is also possible to set multiple roles for a user, such as administrator, monitoring for the user developer:
1
rabbitmqctl set_user_tags developer administrator monitoring
III Privilege Configuration
Now this developer account doesn’t have the privileges to manage configure, write, and read, so we need to add them.
Setting Up Permissions
1
rabbitmqctl set_permissions -p / developer ".*" ".*" ".*"
View the permissions of all users on the specified vhostpath.
1
rabbitmqctl list_permissions
View all user permissions for virtual host as /
1
rabbitmqctl list_permissions -p /
To view the privileges of a specified user
1
rabbitmqctl list_user_permissions developer
Clearing User Privileges
1
rabbitmqctl clear_permissions developer
consultation : https://www.cnblogs.com/ericli-ericli/p/5902270.html