CentOS7.6安装RabbitMQ
1、CentOS7.6安装RabbitMQ
yum install -y socat yum install -y erlang
2、安装rabbitmq
yum install rabbitmq-server
3、启动rabbitmq
sudo systemctl start rabbitmq-server
4、检查启动情况
sudo systemctl status rabbitmq-server
5、设置开机启动
sudo systemctl enable rabbitmq-server
6、安装启动RabbitMQWeb管理界面
rabbitmq-plugins enable rabbitmq_management
7、修改配置文件
vim rabbitmq.config #把内容全删了或者新建一个,然后把下面这句话放进去 [{rabbit,[{loopback_users,[]}]}].
8、增加用户
[root@ecs-lanxinmeichen rebbitmq]# rabbitmqctl add_user lxmcadmin lxmcadmin Creating user "lxmcadmin" ... ...done. [root@ecs-lanxinmeichen rebbitmq]# rabbitmqctl set_user_tags lxmcadmin administrator Setting tags for user "lxmcadmin" to [administrator] ... ...done. [root@ecs-lanxinmeichen rebbitmq]# rabbitmqctl set_permissions -p / lxmcadmin ".*" ".*" ".*" Setting permissions for user "lxmcadmin" in vhost "/" ... ...done.
9、mq常用命令
# 添加用户 sudo rabbitmqctl add_user <username> <password> # 删除用户 sudo rabbitmqctl delete_user <username> # 修改用户密码 sudo rabbitmqctl change_password <username> <newpassword> # 清除用户密码(该用户将不能使用密码登陆,但是可以通过SASL登陆如果配置了SASL认证) sudo rabbitmqctl clear_password <username> # 设置用户tags(相当于角色,包含administrator,monitoring,policymaker,management) sudo rabbitmqctl set_user_tags <username> <tag> # 列出所有用户 sudo rabbitmqctl list_users # 创建一个vhosts sudo rabbitmqctl add_vhost <vhostpath> # 删除一个vhosts sudo rabbitmqctl delete_vhost <vhostpath> # 列出vhosts sudo rabbitmqctl list_vhosts [<vhostinfoitem> ...] # 针对一个vhosts给用户赋予相关权限; sudo rabbitmqctl set_permissions [-p <vhostpath>] <user> <conf> <write> <read> # 清除一个用户对vhosts的权限; sudo rabbitmqctl clear_permissions [-p <vhostpath>] <username> # 列出哪些用户可以访问该vhosts; sudo rabbitmqctl list_permissions [-p <vhostpath>] # 列出用户访问权限; sudo rabbitmqctl list_user_permissions <username>
你所拥抱的并不总是拥抱你