1. 养乐多|杨城的个人博客首页
  2. 技术杂谈
  3. Other

CentOS 7安装配置RabbitMQ

一. 安装erlang
1)下载erlang

[root@localhost src]# wget http://www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el7.centos.x86_64.rpm

2)安装erlang

[root@localhost src]# rpm -ihv erlang-19.0.4-1.el7.centos.x86_64.rpm

二.安装RabbitMQ
1)下载rabbitmq

[root@localhost src]# wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el7.noarch.rpm

2)导入key文件

[root@localhost src]# rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc

3)安装rabbitmq

[root@localhost src]# yum install -y rabbitmq-server-3.6.6-1.el7.noarch.rpm

三.开启可视化插件

[root@localhost src]# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
  amqp_client
  cowlib
  cowboy
  rabbitmq_web_dispatch
  rabbitmq_management_agent
  rabbitmq_management

Applying plugin configuration to rabbit@localhost... failed.
 * Could not contact node rabbit@localhost.
   Changes will take effect at broker restart.
 * Options: --online  - fail if broker cannot be contacted.
            --offline - do not try to contact broker.

(注意:上面出现报错信息 Applying plugin configuration to rabbit@localhost… failed.
是因为没有启动rabbit服务也就是需要先开启服务:service rabbitmq-server start)
四.添加远程访问用户,并分配权限

[root@localhost src]# rabbitmqctl add_user yangcheng 123456
Error: unable to connect to node rabbit@localhost: nodedown

DIAGNOSTICS
===========

attempted to contact: [rabbit@localhost]

rabbit@localhost:
  * connected to epmd (port 4369) on localhost
  * epmd reports: node 'rabbit' not running at all
                  no other nodes on localhost
  * suggestion: start the node

current node details:
- node name: 'rabbitmq-cli-16@localhost'
- home dir: /var/lib/rabbitmq
- cookie hash: JchyWsght/ggnwo3tgnb5Q==

对于上述问题,官网有提到cookie不一致之类的问题,重启服务即可解决。

[root@localhost src]# service rabbitmq-server restart
Restarting rabbitmq-server (via systemctl):                [  OK  ]
# 添加用户
[root@localhost src]# rabbitmqctl add_user yangcheng 123456
Creating user "yangcheng"
# 配置用户组
[root@localhost src]# rabbitmqctl set_user_tags yangcheng administrator
Setting tags for user "yangcheng" to [administrator]
# 分配权限
[root@localhost src]# rabbitmqctl set_permissions -p / yangcheng '.*' '.*' '.*'
Setting permissions for user "yangcheng" in vhost "/"

五.登录访问
可通过服务器IP:端口进行可视化访问,端口默认为15672。(注意防火墙权限)
CentOS 7安装配置RabbitMQ
使用步骤四中创建好的账号即可进行登录访问,如下图
CentOS 7安装配置RabbitMQ

原创文章,作者:iConan,如若转载,请注明出处:https://www.aspyc.com/archives/466.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据