温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

rabbit启动报错Failed to start LSB: Enable AMQP service provided by RabbitMQ broker怎么解决

发布时间:2021-06-26 14:55:52 来源:亿速云 阅读:1745 作者:chen 栏目:编程语言

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

在 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怎么解决”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI