一上班就说服务不能用,赶紧解决一下,然后重启服务试试,结果发现是mq没启动
[root@localhost rabbit@localhost]# service rabbitmq-server start
Starting rabbitmq-server: SUCCESS
rabbitmq-server.
然后网页访问管理页
http://127.0.0.1:15672/
无法访问,一下心理就慌了,好不,试了几次都是没有
检查端口占用
[root@localhost ~]# netstat -anp |grep 4369
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 5582/epmd
tcp 0 0 :::4369 :::* LISTEN 5582/epmd
其实上面的是正常的。
查看服务启动脚本
vi /etc/init.d/rabbitmq-server
rabbitmq-server日志
tail /var/log/rabbitmq/startup_log
{"init terminating in do_boot",{error,{cannot_delete_plugins_expand_dir,["/var/lib/rabbitmq/mnesia/rabbit@localhost-plugins-expand",{cannot_delete,"/var/lib/rabbitmq/mnesia/rabbit@localhost-plugins-expand/rabbitmq_web_dispatch-3.5.0/ebin/rabbit_webmachine.beam",eacces}]}}}
最后发现是插件目录权限问题, 修改属主
chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/mnesia/rabbit@localhost-plugins-expand/
【误区】
1、不要随便重置,或者rabbitmqctl reset,重置队列
2、随便禁用插件, /etc/rabbitmq/enabled_plugins
3、 sudo /usr/sbin/rabbitmq-server 报错pid权限不够
【总结】一下,防止后人采坑:
1、检查防火墙
service iptables status
2、检查rabbitmq
[root@localhost rabbit@localhost]# service rabbitmq-server status
Status of node rabbit@localhost ...
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-7227@localhost'
- home dir: /var/lib/rabbitmq
- cookie hash: upI9R3WzVaK8x5qUau1aHg==
3、localhost 是否能够解析
ping localhost
vi /etc/hosts //查看host dns配置
4、RabbitMQ日志
日志目录
tail /var/log/rabbitmq/startup_log
5、插件目录权限
ll /var/lib/rabbitmq/mnesia/
chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/mnesia/rabbit@localhost-plugins-expand/