rabbit启动报错FailedtostartLSB:EnableAMQPserviceprovidedbyRabbitMQbroker怎么解决

本篇内容主要讲解“rabbit启动报错Failed to start LSB: Enable AMQP service provided by RabbitMQ broker怎么解决”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“rabbit启动报错Failed to start LSB: Enable AMQP service provided by RabbitMQ broker怎么解决”吧!

成都创新互联公司是一家专业提供播州企业网站建设,专注与成都网站制作、做网站、H5建站、小程序制作等业务。10年已为播州众多企业、政府机构等服务。创新互联专业的建站公司优惠进行中。

在 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地址的原因吧,具体没 有去测试;
试一下另一个解决方案吧!

其实官网都提示啦,只是自己英语太差,根本没把它当回事!

rabbit启动报错Failed to start LSB: Enable AMQP service provided by RabbitMQ broker怎么解决
# vi /etc/rabbitmq/rabbitmq-env.conf

NODENAME=rabbit@localhost
只需要在文件中写是一句“NODENAME=rabbit@localhost”,保存就OK啦;
# /sbin/service rabbitmq-server start
Starting rabbitmq-server (via systemctl):                  [  确定  ]
启动成功,问题解决了!

到此,相信大家对“rabbit启动报错Failed to start LSB: Enable AMQP service provided by RabbitMQ broker怎么解决”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!


当前题目:rabbit启动报错FailedtostartLSB:EnableAMQPserviceprovidedbyRabbitMQbroker怎么解决
标题路径:http://pwwzsj.com/article/jdecgi.html