(1条消息) Centos7下的rabbitmq
推荐大家看看这篇文章:https://blog.csdn.net/qq_27669839/article/details/113418827
下载安装文件
在网上去下载rabbmitmq-3.8.11,同时还需要下载erlang的依赖包,推荐下载地址
https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.8.11
https://github.com/rabbitmq/erlang-rpm/releases
https://centos.pkgs.org/7/lux/socat-1.7.3.2-5.el7.lux.x86_64.rpm.html
开始安装文件
启动rabbitmq
systemctl enable rabbitmq-server
systemctl start rabbitmq-server
systemctl status rabbitmq-server
Web插件安装
rabbitmq-plugins enable rabbitmq_management
开启15672端口
-- 添加端口-- permanent 代表永久添加firewall-cmd --zone=public --add-port=15672/tcp --permanent
-- 重启防火墙firewall-cmd --reload
访问Rabbitmq的浏览器端
http://IP:15672
账号和密码 guest
提示当前只能本地访问,需要配置远程用户才能远程访问
配置远程用户
[root@localhost~]# vim /etc/rabbitmq/rabbitmq.config [{rabbit, [{loopback_users, []}]}]. [root@localhost~]#
重启Rabbitmq
[root@localhost~]# systemctl restart rabbitmq-server
创建管理用户
#添加用户(用户admin,密码admin)
[root@localhost~]# rabbitmqctl add_user admin admin
Adding user "admin" ...
#设置用户角色(admin为管理员)
[root@locahost~]# rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...
#设置用户权限(接受来自所有Host的所有操作)
[root@localhost~]# rabbitmqctl set_permissions -p "/" admin '.*' '.*' '.*'
Setting permissions for user "admin" in vhost "/" ...
#查看用户权限
[root@localhost~]# rabbitmqctl list_user_permissions admin
Listing permissions for user "admin" ...
vhost configure write read
/ .* .* .*
[root@iZbp1jaz33icbt3708j6yyZ ~]#
RabbitMQ常用命令
# 添加用户
rabbitmqctl add_user <username> <password>
# 删除用户
rabbitmqctl delete_user <username>
# 修改用户密码
rabbitmqctl change_password <username> <newpassword>
# 清除用户密码(该用户将不能使用密码登陆,但是可以通过SASL登陆如果配置了SASL认证)
rabbitmqctl clear_password <username>
# 设置用户tags(相当于角色,包含administrator,monitoring,policymaker,management)
rabbitmqctl set_user_tags <username> <tag>
# 列出所有用户
rabbitmqctl list_users
# 创建一个vhosts
rabbitmqctl add_vhost <vhostpath>
# 删除一个vhosts
rabbitmqctl delete_vhost <vhostpath>
# 列出vhosts
rabbitmqctl list_vhosts [<vhostinfoitem> ...]
# 针对一个vhosts给用户赋予相关权限;
rabbitmqctl set_permissions [-p <vhostpath>] <user> <conf> <write> <read>
# 清除一个用户对vhosts的权限;
rabbitmqctl clear_permissions [-p <vhostpath>] <username>
# 列出哪些用户可以访问该vhosts;
rabbitmqctl list_permissions [-p <vhostpath>]
# 列出用户访问权限;
rabbitmqctl list_user_permissions <username>
赞 (0)