Rabbitmq
Ubuntu 16.04 中的 rabbit-mq 無法啟動而沒有明確的消息錯誤
我有一個
rabbit-mq
服務正在執行,但我突然發現該服務沒有執行並且我無法啟動它。我檢查了其他有關此類問題的現有問題,其中大多數指向 /etc/hosts 配置中的問題
重啟的結果是:
/etc/init.d/rabbitmq-server restart
[....] Restarting rabbitmq-server (via systemctl): rabbitmq-server.serviceJob 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!
systemctl 中的詳細資訊是:
systemctl status rabbitmq-server.service rabbitmq-server.service - RabbitMQ Messaging Server Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since mié 2018-10-03 13:07:32 CEST; 42s ago Process: 5545 ExecStop=/usr/sbin/rabbitmqctl stop (code=exited, status=2) Process: 4564 ExecStartPost=/usr/lib/rabbitmq/bin/rabbitmq-server-wait (code=exited, status=2) Process: 4563 ExecStart=/usr/sbin/rabbitmq-server (code=exited, status=1/FAILURE) Main PID: 4563 (code=exited, status=1/FAILURE) systemd[1]: Starting RabbitMQ Messaging Server... rabbitmq[4564]: Waiting for rabbit@edr ... rabbitmq[4564]: pid is 4571 ... systemd[1]: rabbitmq-server.service: Main process exited, code=exited, status=1/FAILURE rabbitmq[4564]: Error: process_not_running systemd[1]: rabbitmq-server.service: Control process exited, code=exited status=2 systemd[1]: Failed to start RabbitMQ Messaging Server. systemd[1]: rabbitmq-server.service: Unit entered failed state. systemd[1]: rabbitmq-server.service: Failed with result 'exit-code'.
結果
journalctl -xe
沒有提供更多資訊。文件 /var/log/rabbitmq/startup_err 顯示一條消息被截斷,如下所示:
Crash dump is being written to: erl_crash.dump...done Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,auth,{"Cookie file /var/lib/rabbitmq/.erl tail: /var/log/rabbitmq/startup_err: file truncated
當rabbit-mq無法啟動時,是否有另一種方法可以找到確切的錯誤?
最後我發現了詳細的錯誤,
/var/log/rabbitmq/startup_log
其中說:{error_logger,{{2018,10,3},{13,14,18}},“Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by owner only”,[]}
我認為讓rabbitmq創建一個新文件會更好,所以應用的解決方案是刪除erlang cookie文件:
rm /var/lib/rabbitmq/.erlang.cookie
之後,重新啟動 rabbitmq 使其再次工作。
chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie chmod 600 /var/lib/rabbitmq/.erlang.cookie