无法使用systemctl在centos 7中启动rabbitmq服务器

时间:2014-09-12 21:12:54

标签: rabbitmq centos7

我正在尝试在centos 7中启动rabbitmq服务器。我安装了erlang,因为它是对rabbitmq-server的依赖。包erlang.x86_64 0:R16B-03.7.el7。然后使用package rabbitmq-server-3.2.2-1.noarch.rpm安装rabbitmq。安装成功。我启用了管理控制台uisng rabbitmq-plugins启用rabbitmq_management。但是在启动服务rabbitmq-server时失败了。

[root@tve-centos ~]# systemctl start rabbitmq-server.service
Job for rabbitmq-server.service failed. See 'systemctl status rabbitmq-server.service' and 'journalctl -xn' for details.
[root@tve-centos ~]# 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 Fri 2014-09-12 13:07:05 PDT; 8s ago
  Process: 20235 ExecStart=/etc/rc.d/init.d/rabbitmq-server start (code=exited, status=1/FAILURE)

Sep 12 13:07:04 tve-centos su[20245]: (to rabbitmq) root on none
Sep 12 13:07:05 tve-centos su[20296]: (to rabbitmq) root on none
Sep 12 13:07:05 tve-centos su[20299]: (to rabbitmq) root on none
Sep 12 13:07:05 tve-centos rabbitmq-server[20235]: Starting rabbitmq-server: FAILED - check /var/log/rabbitmq/startup_{log, _err}
Sep 12 13:07:05 tve-centos rabbitmq-server[20235]: rabbitmq-server.
Sep 12 13:07:05 tve-centos systemd[1]: rabbitmq-server.service: control process exited, code=exited status=1
Sep 12 13:07:05 tve-centos systemd[1]: Failed to start LSB: Enable AMQP service provided by RabbitMQ broker.
Sep 12 13:07:05 tve-centos systemd[1]: Unit rabbitmq-server.service entered failed state.

和日志显示/ var / log / rabbitmq / startup_log     BOOT FAILED     ===========

Error description:
   {could_not_start,rabbitmq_management,
                    {could_not_start_listener,[{port,15672}],eacces}}

Log files (may contain more information):
   /var/log/rabbitmq/rabbit@tve-centos.log
   /var/log/rabbitmq/rabbit@tve-centos-sasl.log

但没有进程使用端口15672

但如果我尝试使用/ usr / sbin / rabbitmq-server 启动它。我成功启动了该服务。但我的要求是使用systemctl启动它。

3 个答案:

答案 0 :(得分:19)

更好的答案是实际修复SELinux和防火墙。

打开端口:

firewall-cmd --permanent --add-port=5672/tcp
firewall-cmd --reload
setsebool -P nis_enabled 1

这适合我。

答案 1 :(得分:1)

它看起来像一个端口问题。确认

systemctl stop firewalld
systemctl disable firewalld 

暂时在/ etc / selinux / config文件中禁用SELinux

SELINUX=disabled

尝试重新启动计算机并查看问题是否仍然存在。

答案 2 :(得分:1)

运行此命令后:

[root@gcp-hehe-amqp ~]# /sbin/service rabbitmq-server start

并得到错误:

Redirecting to /bin/systemctl start rabbitmq-server.service
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"

经过多次尝试,我按照以下步骤解决了错误:

  1. 运行命令: firewall-cmd --permanent --add-port=5672/tcp
  2. 然后:firewall-cmd --reload
  3. 更改此设置:SELINUX=disabled在/ etc / selinux / config
  4. 在/etc/rabbitmq/rabbitmq.conf启用代理协议为真

    proxy_protocol = true