rabbitmq 因为磁盘空间不足等问题无法重新启动的问题解决

Life is short , play more!
本文来自lihao's Blog,转载请注明。

当因为电源问题或者磁盘空间不足导致rabbitmq服务异常停止之后,再次重启无法启动的问题解决。
RabbitMQ 3.5.6. Copyright (C) 2007-2015 Pivotal Software, Inc.
## ## Licensed under the MPL. See http://www.rabbitmq.com/
## ##
########## Logs: /var/log/rabbitmq/[email protected]
###### ## /var/log/rabbitmq/[email protected]
##########
Starting broker...

BOOT FAILED
===========

Error description:
{could_not_start,rabbit,
{{badmatch,
{error,
{{{{case_clause,undefined},
[{rabbit_queue_index,add_segment_relseq_entry,3,[]},
{rabbit_queue_index,parse_segment_entries,3,[]},
{rabbit_queue_index,'-recover_journal/1-fun-0-',1,[]},
{lists,map,2,[{file,"lists.erl"},{line,1237}]},
{rabbit_queue_index,segment_map,2,[]},
{rabbit_queue_index,recover_journal,1,[]},
{rabbit_queue_index,scan_segments,3,[]},
{rabbit_queue_index,queue_index_walker_reader,2,[]}]},
{gen_server2,call,[<0.241.0>,out,infinity]}},
{child,undefined,msg_store_persistent,
{rabbit_msg_store,start_link,

如上提示可以看到,提示queue 有损坏,导致异常无法启动。

[email protected] 是以节点为命名的目录(这个目录替换成你对应的节点目录)
[[email protected] ~]# ls /var/lib/rabbitmq/mnesia/[email protected]/queues
17BD92SOBZHLASJ4UE5VT5EHQ 3UM4MIP6TJ0PEAHMBSCNUX731 621MT7APTTVO66OSRLB1R7FY5 9R728VE21EGPVSMK9AJ7YH67E A4SL081HP0B21UALPRHLK069R ACJVPWBZHI24WLV6QHBPNT5JE ETHYXYWKQVKD3Q2EYD84UWIS2

#我们讲这些queues文件备份一下。
[[email protected] ~]# mkdir -p /tmp/badrabbit/; mv /var/lib/rabbitmq/mnesia/[email protected]/queues/* /tmp/

若此时重启仍会提示

{not_a_dets_file,"/var/lib/rabbitmq/mnesia/[email protected]/recovery.dets"}

这时候我们再移除
[[email protected] ~]# mkdir -p /tmp/badrabbit/; mv /var/lib/rabbitmq/mnesia/[email protected]/recovery.dets /tmp/badrabbit/;

重启后rabbitmq 启动未再发现异常,可以登录控制台。


发表评论

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