rabbitmq recovery fail處理

rabbitmq啟動失敗時,可查看log (/var/log/rabbitmq)或是使用command line方式啟動rabbitmq-server

可以看出 /var/lib/rabbitmq/mnesia/$HOST 下的 recovery.dets 可能損毀
檢查一下 ls -l recovery.dets 發現檔案大小是0 代表可能當時開啟檔案後寫入失敗

這在當硬碟空間不足時可能發生,rabbitmq預設小於50MB時會停止服務(一般是每10秒檢查一次 disk alarm on時 等待consumer消耗掉messages,但也有可能是其他process影響到磁碟空間)

When free disk space drops below a configured limit (50MB by default), an alarm will be triggered and all producers will be blocked. The goal is to avoid filling up the entire disk which will lead all write operations on the node to fail and can lead to RabbitMQ termination

當磁碟空間不足時,可以一併檢查一些系統log,也能發現蛛絲馬跡,例如/var/log/auth.log, /var/log/kern.log 看那段時間點(可參考recovery.dets的檔案modified time) log的寫入狀況或是內容,如果在系統未關機的情況下log短缺很多,可以判斷當時log可能寫不進去

因檔案毀損無法啟動的情形,將/var/lib/rabbitmq/mnesia/rabbit@HOST下的檔案清乾淨即可重新正常啟動rabbitmq

This entry was posted in System Administration. Bookmark the permalink.

Leave a Reply