安装时报错:
[root@mq local]# /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.
当然,可能所有安装报错都是出来这条信息,需要进一步查看日志。敲 journalctl -xe 命令到控制台,查看详细的报错原因。
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
Active: deactivating (stop) (Result: exit-code)
Process: 5802 ExecStart=/usr/sbin/rabbitmq-server (code=exited, status=1/FAILURE)
Main PID: 5802 (code=exited, status=1/FAILURE); : 6111 (beam.smp)
CGroup: /system.slice/rabbitmq-server.service
├─6000 /usr/lib64/erlang/erts-8.0.3/bin/epmd -daemon
└─control
├─6111 /usr/lib64/erlang/erts-8.0.3/bin/beam.smp -B -- -root /usr/lib64/erlang -progname erl -- -home /var/lib/rabbitmq -- -boot start_clean -noshell -noinput -noshell -hidden -smp enable -kernel inet_dist_listen_min 35672 -kernel inet_dist_listen_max 35...
└─6217 erl_child_setup 32768
Nov 05 15:55:33 mq systemd[1]: rabbitmq-server.service holdoff time over, scheduling restart.
Nov 05 15:55:33 mq systemd[1]: Starting RabbitMQ broker...
Nov 05 15:55:34 mq rabbitmq-server[5802]: Error: This RabbitMQ version cannot run on Erlang 19.0.4 (erts 8.0.3): minimum required version is 19.3 (erts 8.3)
Nov 05 15:55:36 mq rabbitmq-server[5802]: {"Kernel pid terminated",application_controller,"{application_start_failure,rabbit,{{erlang_version_too_old,\"Erlang 19.3 or later is required, started on 19.0.4\"},{rabbit,start,[normal,[]]}}}"}
Nov 05 15:55:36 mq rabbitmq-server[5802]: Kernel pid terminated (application_controller) ({application_start_failure,rabbit,{{erlang_version_too_old,"Erlang 19.3 or later is required, started on 19.0.4"},{rabbit,start,[normal,[]]}}})
Nov 05 15:55:37 mq systemd[1]: rabbitmq-server.service: main process exited, code=exited, status=1/FAILURE
查看报错日志可得,Erlang版本太低。但是我是用yum方式安装的Erlang。
所以百度一下得知,yum中的Erlang源版本太低。我又去RabbitMQ官网上去找资源,发现也是版本太低,只有截止到19.0版本的包。又去github中找资源,终于找到了。
直接修改yum源:
#vim /etc/yum.repos.d/rabbitmq-erlang.repo
[rabbitmq-erlang]
name=rabbitmq-erlang
baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/7
gpgcheck=1
gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
repo_gpgcheck=0
enabled=1
#yum clean all
#yum makecache
记得先删除旧版本,然后直接yum install安装即可。
然后要是还报错的话,可以把RabbitMQ重新装一遍。
若启动RabbitMQ的时候遇到下面这个错误:
Redirecting to /bin/systemctl start rabbitmq-server.service
Failed to start rabbitmq-server.service: Unit not found
说明你忘记装Erlang了,或者Erlang装的有问题。最好删干净,再重装。