RabbitMQ 安装错误

Posted

技术标签:

【中文标题】RabbitMQ 安装错误【英文标题】:RabbitMQ installation Error 【发布时间】:2018-12-13 14:30:32 【问题描述】:

我在 ubuntu16.04 上安装 rabbitMQ。但我得到了错误。我尝试搜索它但无法解决它。

Adding group `rabbitmq' (GID 131) ...
Done.
Adding system user `rabbitmq' (UID 123) ...
Adding new user `rabbitmq' (UID 123) with group `rabbitmq' ...
Not creating home directory `/var/lib/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.
invoke-rc.d: initscript rabbitmq-server, action "start" failed.
● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Thu 2018-07-05 12:21:02 IST; 3ms ago
  Process: 9259 ExecStop=/bin/sh -c while ps -p $MAINPID >/dev/null 2>&1; do sleep 1; done (code=exited, status=0/SUCCESS)
  Process: 9107 ExecStop=/usr/lib/rabbitmq/bin/rabbitmqctl stop (code=exited, status=0/SUCCESS)
  Process: 8788 ExecStart=/usr/lib/rabbitmq/bin/rabbitmq-server (code=exited, status=1/FAILURE)
 Main PID: 8788 (code=exited, status=1/FAILURE)

Jul 05 12:21:02 sumit-precision-7520 systemd[1]: Failed to start RabbitMQ broker.
Jul 05 12:21:02 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Unit entered failed state.
Jul 05 12:21:02 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Failed with result 'exit-code'.
dpkg: error processing package rabbitmq-server (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for systemd (229-4ubuntu21.2) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
 rabbitmq-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

当我运行以下命令时。

systemctl status rabbitmq-server.service

输出:

● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Thu 2018-07-05 12:21:26 IST; 8s ago
  Process: 10278 ExecStop=/bin/sh -c while ps -p $MAINPID >/dev/null 2>&1; do sleep 1; done (code=exited, status=0/SUCCESS)
  Process: 10127 ExecStop=/usr/lib/rabbitmq/bin/rabbitmqctl stop (code=exited, status=0/SUCCESS)
  Process: 9805 ExecStart=/usr/lib/rabbitmq/bin/rabbitmq-server (code=exited, status=1/FAILURE)
 Main PID: 9805 (code=exited, status=1/FAILURE)

Jul 05 12:21:26 sumit-precision-7520 systemd[1]: Failed to start RabbitMQ broker.
Jul 05 12:21:26 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Unit entered failed state.
Jul 05 12:21:26 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Failed with result 'exit-code'.

我的主机条目是:

127.0.0.1       localhost
127.0.1.1       sumit-precision-7520

当我检查这个 /var/log/rabbitmq/ 路径时,里面没有文件。

为什么我得到这个输出。我该如何解决它。

编辑

以下命令的输出

CMD: journalctl -xe

-- Unit rabbitmq-server.service has begun starting up.
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: BOOT FAILED
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: ===========
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: Error description:
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:    noproc
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: Log files (may contain more information):
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:    /var/log/rabbitmq/rabbit@sumit-precision-7520.log
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:    /var/log/rabbitmq/rabbit@sumit-precision-7520-sasl.log
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: Stack trace:
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:    [gen,do_for_proc,2,[file,"gen.erl",line,228],
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:     gen_event,rpc,2,[file,"gen_event.erl",line,239],
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:     rabbit,ensure_working_log_handlers,0,
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:             [file,"src/rabbit.erl",line,856],
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:     rabbit,'-boot/0-fun-0-',0,[file,"src/rabbit.erl",line,288],
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:     rabbit,start_it,1,[file,"src/rabbit.erl",line,424],
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:     init,start_em,1,[],
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:     init,do_boot,3,[]]
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: =INFO REPORT==== 10-Jul-2018::11:29:58.597458 ===
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: Error description:
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:    noproc
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: Log files (may contain more information):
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:    /var/log/rabbitmq/rabbit@sumit-precision-7520.log
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:    /var/log/rabbitmq/rabbit@sumit-precision-7520-sasl.log
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: Stack trace:
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:    [gen,do_for_proc,2,[file,"gen.erl",line,228],
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:     gen_event,rpc,2,[file,"gen_event.erl",line,239],
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:     rabbit,ensure_working_log_handlers,0,
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:             [file,"src/rabbit.erl",line,856],
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:     rabbit,'-boot/0-fun-0-',0,[file,"src/rabbit.erl",line,288],
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:     rabbit,start_it,1,[file,"src/rabbit.erl",line,424],
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:     init,start_em,1,[],
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]:     init,do_boot,3,[]]
Jul 10 11:29:59 sumit-precision-7520 rabbitmq-server[29523]: "init terminating in do_boot",noproc
Jul 10 11:29:59 sumit-precision-7520 rabbitmq-server[29523]: init terminating in do_boot (noproc)
Jul 10 11:29:59 sumit-precision-7520 rabbitmq-server[29523]: [1B blob data]
Jul 10 11:29:59 sumit-precision-7520 rabbitmq-server[29523]: Crash dump is being written to: erl_crash.dump...done
Jul 10 11:29:59 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Main process exited, code=exited, status=1/FAILURE
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: Stopping and halting node 'rabbit@sumit-precision-7520'
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: Error: unable to connect to node 'rabbit@sumit-precision-7520': nodedown
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: DIAGNOSTICS
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: ===========
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: attempted to contact: ['rabbit@sumit-precision-7520']
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: rabbit@sumit-precision-7520:
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]:   * connected to epmd (port 4369) on sumit-precision-7520
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]:   * epmd reports: node 'rabbit' not running at all
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]:                   no other nodes on sumit-precision-7520
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]:   * suggestion: start the node
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: current node details:
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: - node name: 'rabbitmq-cli-19@sumit-precision-7520'
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: - home dir: /var/lib/rabbitmq
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: - cookie hash: Yz59fP8Pd/2GV5iaJa/Xng==
Jul 10 11:30:00 sumit-precision-7520 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.
Jul 10 11:30:00 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Unit entered failed state.
Jul 10 11:30:00 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Failed with result 'exit-code'.

CMD: /usr/sbin/rabbitmq-server as root

BOOT FAILED
===========

Error description:
   noproc

Log files (may contain more information):
   /var/log/rabbitmq/rabbit@sumit-precision-7520.log
   /var/log/rabbitmq/rabbit@sumit-precision-7520-sasl.log

Stack trace:
   [gen,do_for_proc,2,[file,"gen.erl",line,228],
    gen_event,rpc,2,[file,"gen_event.erl",line,239],
    rabbit,ensure_working_log_handlers,0,
            [file,"src/rabbit.erl",line,856],
    rabbit,'-boot/0-fun-0-',0,[file,"src/rabbit.erl",line,288],
    rabbit,start_it,1,[file,"src/rabbit.erl",line,424],
    init,start_em,1,[],
    init,do_boot,3,[]]

=INFO REPORT==== 10-Jul-2018::11:33:14.902211 ===
Error description:
   noproc

Log files (may contain more information):
   /var/log/rabbitmq/rabbit@sumit-precision-7520.log
   /var/log/rabbitmq/rabbit@sumit-precision-7520-sasl.log

Stack trace:
   [gen,do_for_proc,2,[file,"gen.erl",line,228],
    gen_event,rpc,2,[file,"gen_event.erl",line,239],
    rabbit,ensure_working_log_handlers,0,
            [file,"src/rabbit.erl",line,856],
    rabbit,'-boot/0-fun-0-',0,[file,"src/rabbit.erl",line,288],
    rabbit,start_it,1,[file,"src/rabbit.erl",line,424],
    init,start_em,1,[],
    init,do_boot,3,[]]


"init terminating in do_boot",noproc
init terminating in do_boot (noproc)

Crash dump is being written to: erl_crash.dump...done

我还检查了位置/var/log/rabbitmq/rabbit@sumit-precision-7520.log 的日志文件 但没有生成日志文件。

编辑 2

安装过程:

$ wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
$ sudo dpkg -i erlang-solutions_1.0_all.deb
$ sudo apt-get update
$ sudo apt-get install esl-erlang
$ echo "deb http://www.rabbitmq.com/debian/ testing main"  | sudo tee /etc/apt/sources.list.d/rabbitmq.list > /dev/null
$ sudo wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
$ sudo apt-key add rabbitmq-signing-key-public.asc
$ sudo apt-get update
$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 6B73A36E6026DFCA
$ sudo apt-get update
$ sudo apt-get install rabbitmq-server

在安装 erlang 和 rabbitmq-server 之前,我已经安装了 LAMP(Apache, mysql and php7.0) 和 node.js。 我之前安装过相同的,它工作正常。我不明白我在这里缺少什么。

【问题讨论】:

您必须检查/var/log/rabbitmq 中的日志文件才能了解RabbitMQ 没有启动的原因。 @LukeBakken 感谢您的回复。我已经检查了日志,但没有创建日志文件,正如我在问题中已经提到的那样。 当您将/usr/sbin/rabbitmq-server 运行为root 时会发生什么? 您是否尝试过按照建议运行journalctl -xe,看看它是否包含有用的信息? 我已经添加了上述命令的输出。还是没能找到问题。 【参考方案1】:

这是一个保证可以工作的Vagrantfile - 我刚刚对其进行了测试:

https://gist.github.com/lukebakken/44f2fe3770d43dd12acfe6dfbc1818d3


注意:RabbitMQ 团队会监控 the rabbitmq-users mailing list,并且有时只会回答 *** 上的问题。

【讨论】:

【参考方案2】:

从存储库安装时,我遇到了完全相同的问题。根据官方网站上的手册,通过从 .deb 文件中安装 Erlang 和 RabbitMQ 来解决: https://www.rabbitmq.com/install-debian.html

【讨论】:

存储库出现问题。不知何故,它更早地工作了。我已经按照 Luke Bakken 的建议更新了我的存储库,它现在正在运行。【参考方案3】:

我在使用 apt-get install 方法完成安装后尝试启动服务时也遇到了同样的错误。按照以下网址中的文档进行操作。 我可以理解 debain9 安装有同样的问题。

https://tecadmin.net/install-rabbitmq-server-debian/

root@rabbitmq:/var/log/rabbitmq# cat startup_log

BOOT FAILED
===========

Error description:
   noproc

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

我已经按照dpkg -i 安装步骤解决了这个问题,以下是我遵循的步骤。

apt-get purge rabbitmq-server
apt-get purge erlang
apt-get autoremove
reboot

通过dpkg方法安装解决了问题

在 dpkg 方法之前需要修复的依赖项。

apt-get -y install socat logrotate init-system-helpers adduser
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.15/rabbitmq-server_3.7.15-1_all.deb

/etc/init.d/rabbitmq-server start

服务已经开始良好。

【讨论】:

【参考方案4】:

您应该安装 RabbitMQ 的版本与安装的 Erlang 版本兼容

RabbitMQ Erlang 版本要求可以在这里找到:https://www.rabbitmq.com/which-erlang.html#compatibility-matrix

    在终端中获取 Erlang 版本类型:
erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().'  -noshell
    删除之前安装的 RabbitMQ:
$ sudo apt-get purge rabbitmq-server
$ sudo rm -fr /var/lib/rabbitmq/
    要安装适当版本的 RabbitMQ,您应该从 repo 进行: https://www.rabbitmq.com/install-debian.html#manual-installation

在我的情况下(Erlang v21)所需的 RabbitMQ 版本是 3.7.17:

$ sudo apt-get -y install socat logrotate init-system-helpers adduser
$ cd /opt/tools/
$ sudo wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.17/rabbitmq-server_3.7.17-1_all.deb
$ sudo dpkg -i rabbitmq-server_3.7.17-1_all.deb
$ sudo rm rabbitmq-server_3.7.17-1_all.deb

【讨论】:

在这里获取正确版本的 erlang 包:erlang-solutions.com/resources/download.html#tabs-debian 感谢您的帮助,这个答案必须被接受!

以上是关于RabbitMQ 安装错误的主要内容,如果未能解决你的问题,请参考以下文章

rabbitmq-server 安装 CentOS - Erlang 错误

rabbitmq安装错误集

linux 7.2 安装openstack 过程出现rabbitmq-server 错误解决方法

RabbitMQ:MSVCR120.dll ,c000001d 错误

Windows x64 RabbitMQ 安装错误与 Erlang 环境变量 (ERLANG_HOME)

win7 32位 rabbitmq安装后,启动service时报了很多错误