我有一个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启动失败时,还有其他方法可以找到确切的错误吗?
答案1
最后我找到了详细的错误,/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即可再次工作。
答案2
chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie
chmod 600 /var/lib/rabbitmq/.erlang.cookie