问题描述:在使用命令/sbin/service rabbitmq-server start启动Rabbitmq时,报:
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.
根据以上错误信息,使用“journalctl -xe”命令查看启动失败日志:
[root@192 bin]# journalctl -xe
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit rabbitmq-server.service has begun starting up.
1月 08 19:12:46 sanyue rabbitmq-server[10306]: /usr/lib/rabbitmq/bin/rabbitmq-server: line 85: erl: command not found
1月 08 19:12:46 sanyue systemd[1]: rabbitmq-server.service: main process exited, code=exited, status=127/n/a
1月 08 19:12:46 sanyue rabbitmqctl[10473]: /usr/lib/rabbitmq/bin/rabbitmqctl: line 32: exec: escript: not found
1月 08 19:12:46 sanyue systemd[1]: rabbitmq-server.service: control process exited, code=exited status=127
1月 08 19:12:46 sanyue systemd[1]: Failed to start RabbitMQ broker.
-- Subject: Unit rabbitmq-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit rabbitmq-server.service has failed.
--
-- The result is failed.
通过上面描述中,发现是rabbitmq-server文件第85没有找到erlang。
解决方法:在rabbitmq-server文件第85行处添加erlang的环境变量
然后执行启动Rabbitmq命令,启动成功。使用/sbin/service rabbitmq-server status查看rabbit状态