linux下安装rabbitmq可能会遇到的问题

linux下安装rabbitmq遇到的问题大多数是rabbitmq版本和erlang版本不兼容问题

问题1:erlang版本要求

erlang >= 21.0 is needed by rabbitmq-server-3.8.12-1.el7.noarch
解决方法:
去官网下载要求的版本

问题2:erlang版本已经下载了要求的版本还是出现问题2的错误

解决方法:
加上–nodeps参数

[root@slave2 local]# rpm -ivh --nodeps rabbitmq-server-3.8.12-1.el7.noarch.rpm 

问题3:启动rabbitmq报错

[root@slave2 rabbitmq]# systemctl start rabbitmq-server
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.

解决方法:
查看日志

[root@slave2 rabbitmq]# journalctl -xe
Feb 19 07:15:52 slave2 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.
Feb 19 07:15:52 slave2 systemd[1]: Unit rabbitmq-server.service entered failed state.
Feb 19 07:15:52 slave2 systemd[1]: rabbitmq-server.service failed.
Feb 19 07:16:01 slave2 polkitd[902]: Registered Authentication Agent for unix-process:52647:403980 (system bus name :1.27 [/usr/bin/pk
Feb 19 07:16:02 slave2 systemd[1]: rabbitmq-server.service holdoff time over, scheduling restart.
Feb 19 07:16:02 slave2 systemd[1]: Stopped RabbitMQ broker.
-- Subject: Unit rabbitmq-server.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rabbitmq-server.service has finished shutting down.
Feb 19 07:16:02 slave2 systemd[1]: Starting RabbitMQ broker...
-- Subject: Unit rabbitmq-server.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rabbitmq-server.service has begun starting up.
Feb 19 07:16:02 slave2 rabbitmq-server[52652]: /usr/lib/rabbitmq/bin/rabbitmq-server: line 82: exec: erl: not found
Feb 19 07:16:02 slave2 systemd[1]: rabbitmq-server.service: main process exited, code=exited, status=127/n/a
Feb 19 07:16:02 slave2 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.
Feb 19 07:16:02 slave2 systemd[1]: Unit rabbitmq-server.service entered failed state.
Feb 19 07:16:02 slave2 systemd[1]: rabbitmq-server.service failed.

发现错误提示,找不到erl环境

Feb 19 07:16:02 slave2 rabbitmq-server[52652]: /usr/lib/rabbitmq/bin/rabbitmq-server: line 82: exec: erl: not found

修改rabbitmq-server启动脚本(启动脚本位置可以在报错日志里面拿到我的是上面报错提示的/usr/lib/rabbitmq/bin/rabbitmq-server)在set -e下面添加两行

#erlang
export PATH=$PATH:/usr/local/erlang/bin


[root@slave2 rabbitmq]# vim /usr/lib/rabbitmq/bin/rabbitmq-server 
#!/bin/sh
# vim:sw=4:et:
##  The contents of this file are subject to the Mozilla Public License
##  Version 1.1 (the "License"); you may not use this file except in
##  compliance with the License. You may obtain a copy of the License
##  at https://www.mozilla.org/MPL/
##
##  Software distributed under the License is distributed on an "AS IS"
##  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
##  the License for the specific language governing rights and
##  limitations under the License.
##
##  The Original Code is RabbitMQ.
##
##  The Initial Developer of the Original Code is GoPivotal, Inc.
##  Copyright (c) 2007-2021 VMware, Inc. or its affiliates.  All rights reserved.
##

set -e
#erlang
export PATH=$PATH:/usr/local/erlang/bin
# Get default settings with user overrides for (RABBITMQ_)
# Non-empty defaults should be set in rabbitmq-env
SCRIPTS_DIR=$(dirname "$0")
. "$SCRIPTS_DIR/rabbitmq-env"

[ "$NOTIFY_SOCKET" ] && RUNNING_UNDER_SYSTEMD=true

RABBITMQ_DEFAULT_ALLOC_ARGS="+MBas ageffcbf +MHas ageffcbf +MBlmbcs 512 +MHlmbcs 512 +MMmcs 30"

# Bump ETS table limit to 50000
if [ "x" = "x$ERL_MAX_ETS_TABLES" ]; then
    ERL_MAX_ETS_TABLES=50000
fi

check_start_params() {
    check_not_empty RABBITMQ_BOOT_MODULE

你可能感兴趣的:(java,java,后端)