(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

创建管理用户

  1. #添加用户(用户admin,密码admin)
  2. [root@localhost~]# rabbitmqctl add_user admin admin
  3. Adding user "admin" ...
  4. #设置用户角色(admin为管理员)
  5. [root@locahost~]# rabbitmqctl set_user_tags admin administrator
  6. Setting tags for user "admin" to [administrator] ...
  7. #设置用户权限(接受来自所有Host的所有操作)
  8. [root@localhost~]# rabbitmqctl set_permissions -p "/" admin '.*' '.*' '.*'
  9. Setting permissions for user "admin" in vhost "/" ...
  10. #查看用户权限
  11. [root@localhost~]# rabbitmqctl list_user_permissions admin
  12. Listing permissions for user "admin" ...
  13. vhost configure write read
  14. / .* .* .*
  15. [root@iZbp1jaz33icbt3708j6yyZ ~]#

RabbitMQ常用命令

  1. # 添加用户
  2. rabbitmqctl add_user <username> <password>
  3. # 删除用户
  4. rabbitmqctl delete_user <username>
  5. # 修改用户密码
  6. rabbitmqctl change_password <username> <newpassword>
  7. # 清除用户密码(该用户将不能使用密码登陆,但是可以通过SASL登陆如果配置了SASL认证)
  8. rabbitmqctl clear_password <username>
  9. # 设置用户tags(相当于角色,包含administrator,monitoring,policymaker,management)
  10. rabbitmqctl set_user_tags <username> <tag>
  11. # 列出所有用户
  12. rabbitmqctl list_users
  13. # 创建一个vhosts
  14. rabbitmqctl add_vhost <vhostpath>
  15. # 删除一个vhosts
  16. rabbitmqctl delete_vhost <vhostpath>
  17. # 列出vhosts
  18. rabbitmqctl list_vhosts [<vhostinfoitem> ...]
  19. # 针对一个vhosts给用户赋予相关权限;
  20. rabbitmqctl set_permissions [-p <vhostpath>] <user> <conf> <write> <read>
  21. # 清除一个用户对vhosts的权限;
  22. rabbitmqctl clear_permissions [-p <vhostpath>] <username>
  23. # 列出哪些用户可以访问该vhosts;
  24. rabbitmqctl list_permissions [-p <vhostpath>]
  25. # 列出用户访问权限;
  26. rabbitmqctl list_user_permissions <username>
(0)

相关推荐