环境:centos Linux service.linxk.lan 3.10.0-862.14.4.el7.x86_64
安装包:
curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash
yum install erlang.x86_64
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
yum install rabbitmq-server (3.7.14版本)
启动方法:
1, systemctl start rabbitmq-server
2,service rabbitmq-server start
3, /usr/lib/rabbitmq/bin/rabbitmq-server start
安装好启动之后发现 执行: rabbitmqctl-status
报错:
Status of node rabbit@service ...
Error: unable to perform an operation on node 'rabbit@service'. Please see diagnostics information and suggestions below.
Most common reasons for this are:
* Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
* CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
* Target node is not running
In addition to the diagnostics info below:
* See the CLI, clustering and networking guides on https://rabbitmq.com/documentation.html to learn more
* Consult server logs on node rabbit@service
* If target node is configured to use long node names, don't forget to use --longnames with CLI tools
DIAGNOSTICS
===========
attempted to contact: [rabbit@service]
rabbit@service:
* connected to epmd (port 4369) on service
* epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic
* can't establish TCP connection to the target node, reason: timeout (timed out)
* suggestion: check if host 'service' resolves, is reachable and ports 25672, 4369 are not blocked by firewall
Current node details:
* node name: 'rabbitmqcli-3378-rabbit@service'
* effective user's home directory: /var/lib/rabbitmq
* Erlang cookie hash: 6y0V31QE7e3kp972ErQd/w==
Error: unable to perform an operation on node 'rabbit@service'. Please see diagnostics information and suggestions below.
没有rabbit@service节点, server就是本机的hostname
解决方法:
在/etc/hosts 中 添加
127.0.0.1 server
在次执行 rabbitmqctl-status
正常显示
Status of node rabbit@service ...
[{pid,1034},
{running_applications,
[{rabbitmq_management,"RabbitMQ Management Console","3.7.14"},
{rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.7.14"},
{rabbitmq_management_agent,"RabbitMQ Management Agent","3.7.14"},
{rabbit,"RabbitMQ","3.7.14"},
{sysmon_handler,"Rate-limiting system_monitor event handler","1.1.0"},
{os_mon,"CPO CXC 138 46","2.4.7"},
.....
开启web管理命令:rabbitmq-plugins enable rabbitmq_management
执行此命令后, 需重启rabbitmq-server
服务系统有个默认的guest账号, 但是只能在本机访问,因此最好在命令好增加一个账号
rabbitmqctl add_user username userpasswd # 添加账号密码
rabbitmqctl set_user_tags username administrator #把账号加入到高级管理
到此就可以用创建的账号密码登录rabbitmq web了!
web 端的配置, 可查看此链接: