在 CentOS 7.2 安装 RabbitMQ ,启动时提示以下信息:
# /sbin/service rabbitmq-server start
Starting rabbitmq-server (via systemctl): 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 If you believe that inet_gethost should be allowed read access on the unix file by default. Then you should report this as a bug. You can generate a local policy module to allow this access. Do allow this access for now by executing: # grep inet_gethost /var/log/audit/audit.log | audit2allow -M mypol # semodule -i mypol.pp 9月 12 12:46:45 192.168.1.155 su[16863]: pam_unix(su:session): session closed for user rabbitmq 9月 12 12:46:45 192.168.1.155 rabbitmq-server[16469]: Starting rabbitmq-server: FAILED - check /var/log/rabbitmq/startup_{log, _err} 9月 12 12:46:45 192.168.1.155 rabbitmq-server[16469]: rabbitmq-server. 9月 12 12:46:45 192.168.1.155 systemd[1]: rabbitmq-server.service: control process exited, code=exited status=1 9月 12 12:46:45 192.168.1.155 systemd[1]: Failed to start LSB: Enable AMQP service provided by 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. 9月 12 12:46:45 192.168.1.155 systemd[1]: Unit rabbitmq-server.service entered failed state. 9月 12 12:46:45 192.168.1.155 systemd[1]: rabbitmq-server.service failed. 9月 12 12:46:45 192.168.1.155 systemd[1]: Removed slice user-986.slice. -- Subject: Unit user-986.slice has finished shutting down -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit user-986.slice has finished shutting down. 9月 12 12:46:45 192.168.1.155 systemd[1]: Stopping user-986.slice. -- Subject: Unit user-986.slice has begun shutting down -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit user-986.slice has begun shutting down. 9月 12 12:46:46 192.168.1.155 polkitd[4950]: Unregistered Authentication Agent for unix-process:16463:35625599 (system bus name :1.1502, object path /org/freedesktop/PolicyKit1/Authentication
# systemctl status rabbitmq-server.service ● rabbitmq-server.service - LSB: Enable AMQP service provided by RabbitMQ broker Loaded: loaded (/etc/rc.d/init.d/rabbitmq-server) Active: failed (Result: exit-code) since 一 2016-09-12 12:46:45 CST; 1min 22s ago Docs: man:systemd-sysv-generator(8) Process: 16469 ExecStart=/etc/rc.d/init.d/rabbitmq-server start (code=exited, status=1/FAILURE) 9月 12 12:46:40 192.168.1.155 systemd[1]: Starting LSB: Enable AMQP service provided by RabbitMQ broker... 9月 12 12:46:41 192.168.1.155 su[16556]: (to rabbitmq) root on none 9月 12 12:46:43 192.168.1.155 su[16863]: (to rabbitmq) root on none 9月 12 12:46:43 192.168.1.155 su[16862]: (to rabbitmq) root on none 9月 12 12:46:45 192.168.1.155 rabbitmq-server[16469]: Starting rabbitmq-server: FAILED - check /var/log/rabbitmq/startup_{log, _err} 9月 12 12:46:45 192.168.1.155 rabbitmq-server[16469]: rabbitmq-server. 9月 12 12:46:45 192.168.1.155 systemd[1]: rabbitmq-server.service: control process exited, code=exited status=1 9月 12 12:46:45 192.168.1.155 systemd[1]: Failed to start LSB: Enable AMQP service provided by RabbitMQ broker. 9月 12 12:46:45 192.168.1.155 systemd[1]: Unit rabbitmq-server.service entered failed state. 9月 12 12:46:45 192.168.1.155 systemd[1]: rabbitmq-server.service failed.输出信息中关键的一句:Starting rabbitmq-server: FAILED - check /var/log/rabbitmq/startup_{log, _err}
# cat /var/log/rabbitmq/startup_err
发现文件是空的;
# cat /var/log/rabbitmq/startup_log
ERROR: epmd error for host 192: badarg (unknown POSIX error)
解决方法
看到日志信息了,还是一脸的懵逼啊!
搜索吧,万能的搜索啊!
找到一要救命稻草:http://stackoverflow.com/questions/8633882/rabbitmq-on-ubuntu-10-04-server
按照第一个方法,查看了一下自己的hostname
# hostname 192.168.1.155居然是IP地址;
编辑 /etc/hosts 文件
# vi /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 192.168.1.155 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6示例,假如你的 hostname 是 67714
su vim /etc/hosts 127.0.0.1 localhost.localdomain localhost 67714 ::1 localhost6.localdomain6 localhost6 service rabbitmq-server start但是不管用啊,还是一样的错误,可能是因为我的hostname是IP地址的原因吧,具体没 有去测试;
试一下另一个解决方案吧!
其实官网都提示啦,只是自己英语太差,根本没把它当回事!
# vi /etc/rabbitmq/rabbitmq-env.conf NODENAME=rabbit@localhost只需要在文件中写是一句“NODENAME=rabbit@localhost”,保存就OK啦;
# /sbin/service rabbitmq-server start Starting rabbitmq-server (via systemctl): [ 确定 ]启动成功,问题解决了!
小结
英语英语英语,还是英语啊,搞IT的英语不好真不行!
===========文档信息============
版权声明:非商用自由转载-保持署名-注明出处
署名(BY) :testcs_dn(微wx笑)
文章出处:[无知人生,记录点滴](http://blog.csdn.net/testcs_dn)