RabbitMQ启动出现的问题与解决办法
作者:互联网
问题1
使用命令启动
service rabbitmq-server start
报错如下:
Starting rabbitmq-server (via systemctl): Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details.
[FAILED]
解决办法:
尝试下面的操作:
禁用 SELinux ,修改 /etc/selinux/config
SELINUX=disabled
修改后重启系统
问题2:
一般使用命令
rabbitmq-server start
可以查看启动相关日志的
BOOT FAILED
===========
Error description:
{could_not_start,rabbit,
{{badmatch,
{error,
{{{badmatch,
{error,
{not_a_dets_file,
"/var/lib/rabbitmq/mnesia/rabbit@n1/recovery.dets"}}},
[{rabbit_recovery_terms,open_table,0,
[{file,"src/rabbit_recovery_terms.erl"},{line,126}]},
{rabbit_recovery_terms,init,1,
[{file,"src/rabbit_recovery_terms.erl"},{line,107}]},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,328}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,247}]}]},
{child,undefined,rabbit_recovery_terms,
{rabbit_recovery_terms,start_link,[]},
transient,30000,worker,
[rabbit_recovery_terms]}}}},
[{rabbit_queue_index,start,1,
[{file,"src/rabbit_queue_index.erl"},{line,491}]},
{rabbit_variable_queue,start,1,
[{file,"src/rabbit_variable_queue.erl"},{line,466}]},
{rabbit_priority_queue,start,1,
[{file,"src/rabbit_priority_queue.erl"},{line,92}]},
{rabbit_amqqueue,recover,0,
[{file,"src/rabbit_amqqueue.erl"},{line,240}]},
{rabbit,recover,0,[{file,"src/rabbit.erl"},{line,800}]},
{rabbit_boot_steps,'-run_step/2-lc$^1/1-1-',1,
[{file,"src/rabbit_boot_steps.erl"},{line,49}]},
{rabbit_boot_steps,run_step,2,
[{file,"src/rabbit_boot_steps.erl"},{line,49}]},
{rabbit_boot_steps,'-run_boot_steps/1-lc$^0/1-0-',1,
[{file,"src/rabbit_boot_steps.erl"},{line,26}]}]}}
Log files (may contain more information):
/var/log/rabbitmq/rabbit@n1.log
/var/log/rabbitmq/rabbit@n1-sasl.log
{"init terminating in do_boot",{could_not_start,rabbit,{{badmatch,{error,{{{badmatch,{error,{not_a_dets_file,"/var/lib/rabbitmq/mnesia/rabbit@n1/recovery.dets"}}},[{rabbit_recovery_terms,open_table,0,[{file,"src/rabbit_recovery_terms.erl"},{line,126}]},{rabbit_recovery_terms,init,1,[{file,"src/rabbit_recovery_terms.erl"},{line,107}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]},{child,undefined,rabbit_recovery_terms,{rabbit_recovery_terms,start_link,[]},transient,30000,worker,[rabbit_recovery_terms]}}}},[{rabbit_queue_index,start,1,[{file,"src/rabbit_queue_index.erl"},{line,491}]},{rabbit_variable_queue,start,1,[{file,"src/rabbit_variable_queue.erl"},{line,466}]},{rabbit_priority_queue,start,1,[{file,"src/rabbit_priority_queue.erl"},{line,92}]},{rabbit_amqqueue,recover,0,[{file,"src/rabbit_amqqueue.erl"},{line,240}]},{rabbit,recover,0,[{file,"src/rabbit.erl"},{line,800}]},{rabbit_boot_steps,'-run_step/2-lc$^1/1-1-',1,[{file,"src/rabbit_boot_steps.erl"},{line,49}]},{rabbit_boot_steps,run_step,2,[{file,"src/rabbit_boot_steps.erl"},{line,49}]},{rabbit_boot_steps,'-run_boot_steps/1-lc$^0/1-0-',1,[{file,"src/rabbit_boot_steps.erl"},{line,26}]}]}}}
init terminating in do_boot ()
Crash dump is being written to: erl_crash.dump...done
解决办法:
find / -name recovery.dets
然后使用 rm 命令删除掉 recoer.dets 文件
问题4 :
使用命令
rabbitmq-server start
报错如下: 提示 no space left on device
/usr/lib/rabbitmq/bin/rabbitmq-server: line 51: echo: write error: No space left on device
Failed to write pid file: /var/lib/rabbitmq/mnesia/rabbit@n3.pid
解决办法:
查看磁盘占用情况
df -h
然后使用
cd / #回到根目录
du -sh * # 查看各个文件夹占用磁盘情况
然后看哪个盘数据多, 就cd 进入哪个盘,然后进行最终找到数据量大的文件。一般是日志文件的话,删除即可。
启动异常
rabbitmq-server start
报错如下:
BOOT FAILED
===========
Error description:
{error,{inconsistent_cluster,"Node rabbit@node1 thinks it's clustered with node rabbit@node2, but rabbit@node2 disagrees"}}
Log files (may contain more information):
/usr/local/rabbitmq_server-3.6.2/var/log/rabbitmq/rabbit@node1.log
/usr/local/rabbitmq_server-3.6.2/var/log/rabbitmq/rabbit@node1-sasl.log
Stack trace:
[{rabbit_mnesia,check_cluster_consistency,0,
[{file,"src/rabbit_mnesia.erl"},{line,593}]},
{rabbit,'-boot/0-fun-0-',0,[{file,"src/rabbit.erl"},{line,279}]},
{rabbit,start_it,1,[{file,"src/rabbit.erl"},{line,407}]},
{init,start_it,1,[]},
{init,start_em,1,[]}]
{"init terminating in do_boot",{error,{inconsistent_cluster,"Node rabbit@node1 thinks it's clustered with node rabbit@node2, but rabbit@node2 disagrees"}}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
如何解决无锡人流医院哪家好 http://www.ytsg029.com/
问题分析,从node1的启动报错来看,像是集群信息残留。在node2上操作将node1移除集群,node1的rabbitmq服务已经down掉了,所以数据库无法同步更新,记载的仍是旧的集群信息(数据库记录里自身节点仍属于集群),而node2和node3的数据库记录已经更新(数据库信息里面集群不包含node1节点了)。
那么就得将这个节点mnesia 数据删掉
找到mnseia 目录
mv mnesia/ /tmp/
如果删了,发现 启动还是报错,很有可能你 删错了 mnesia
find / -name mnesia
查找下,然后再次删除,然后重启
问题,节点加入集群后出现黄框
解决办法:
rabbitmq-plugins enable rabbitmq_management
增加用户 并且赋予角色
rabbitmqctl add_user root root
rabbitmqctl set_user_tags root administrator
问题:
如果节点启动
rabbitmq-server start
报错如下:
BOOT FAILED
===========
Timeout contacting cluster nodes: [rabbit@node2].
BACKGROUND
==========
This cluster node was shut down while other nodes were still running.
To avoid losing data, you should start the other nodes first, then
start this one. To force this node to start, first invoke
"rabbitmqctl force_boot". If you do so, any changes made on other
cluster nodes after this one was shut down may be lost.
DIAGNOSTICS
===========
attempted to contact: [rabbit@node2]
rabbit@node2:
* connected to epmd (port 4369) on node2
* node rabbit@node2 up, 'rabbit' application running
current node details:
- node name: rabbit@node1
- home dir: /root
- cookie hash: jIUJ2lMKMbDhJLdCJgFDAA==
{"init terminating in do_boot",timeout_waiting_for_tables}
解决办法:
rabbitmqctl force_boot
问题:
rabbitmq-server: unrecognized service
解决办法
hostname
查看hostname是否正确
如果使用
vi /etc/hosts
修改了host但是不生效, 那么查看
/etc/sysconfig/network
这个目录下的hostname 是否写死了, 把它修改了,然后重启 reboot
https://www.icode9.com/i/?i=20180322135423539
nohup启动
nohup ./rabbitmq-server start &
标签:解决办法,rabbit,启动,RabbitMQ,rabbitmq,file,erl,line,src 来源: https://www.cnblogs.com/djw12333/p/11497449.html