linux部署RabbitMQ,启动报错。 5C

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.
[root@ecs-c05b 15260846833]# /sbin/service rabbitmq-server status
Redirecting to /bin/systemctl status rabbitmq-server.service
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2018-07-17 17:39:19 CST; 30s ago
Process: 45226 ExecStop=/usr/sbin/rabbitmqctl stop (code=exited, status=0/SUCCESS)
Process: 36903 ExecStart=/usr/sbin/rabbitmq-server (code=exited, status=1/FAILURE)
Main PID: 36903 (code=exited, status=1/FAILURE)

Jul 17 17:39:19 ecs-c05b.novalocal rabbitmqctl[45226]: /usr/lib/rabbitmq/bin/rabbitmq-env: line 34: /dev/null: Permission denied
Jul 17 17:39:19 ecs-c05b.novalocal rabbitmqctl[45226]: Stopping and halting node 'rabbit@ecs-c05b' ...
Jul 17 17:39:19 ecs-c05b.novalocal rabbitmqctl[45226]: Error: unable to connect to node 'rabbit@ecs-c05b': nodedown
Jul 17 17:39:19 ecs-c05b.novalocal rabbitmqctl[45226]: DIAGNOSTICS
Jul 17 17:39:19 ecs-c05b.novalocal rabbitmqctl[45226]: ===========
Jul 17 17:39:19 ecs-c05b.novalocal rabbitmqctl[45226]: attempted to contact: ['rabbit@ecs-c05b']
Jul 17 17:39:19 ecs-c05b.novalocal rabbitmqctl[45226]: rabbit@ecs-c05b:
Jul 17 17:39:19 ecs-c05b.novalocal systemd[1]: Failed to start RabbitMQ broker.
Jul 17 17:39:19 ecs-c05b.novalocal systemd[1]: Unit rabbitmq-server.service entered failed state.
Jul 17 17:39:19 ecs-c05b.novalocal systemd[1]: rabbitmq-server.service failed.

7个回答

/usr/lib/rabbitmq/bin/rabbitmq-env: line 34: /dev/null: Permission denied 权限设置

wei631160
大忽悠-oba 已经是root最高权限了呀,怎么还会权限不够
大约一年之前 回复

这是因为环境配置出问题

wei631160
大忽悠-oba 有没有具体的解决办法
大约一年之前 回复

安装时erlang与rabbitmq版本一直不匹配

wei631160
大忽悠-oba 但是我是根据教程来安装的,版本也是跟教程一样的呀
大约一年之前 回复

我自己根据网上搜的资料做了一个文档,源码安装的,文档里面也有我遇到问题的解决方法,已经测试过,但我不知道怎么发

Centos6.8安装RabbitMQ
安装依赖包
yum list | grep ssl 或者yum install openssl-devel
yum list | grep ODBC 或者yum install unixODBC-devel
yum -y install ncurses-devel gcc-c++ perl libxslt rsync zip xmlto gcc glibc-devel make ncurses-devel openssl-devel autoconf
下载erlang
需先下载wget,yum install –y wget
wget http://www.erlang.org/download/otp_src_19.0.tar.gz
解压erlang
tar zvxf otp_src_19.0.tar.gz -C /usr/local
mv /usr/local/otp_src_19.0 /usr/local/otp (重命名)
cd /usr/local/otp
./configure --prefix=/usr/local/erlang --without-javac --with-opengl --enable-debug --enable-unicode
make && make install (编译erlang)
vi /etc/profile (设置环境变量)
在最后一行添加
PATH=$PATH:/usr/local/erlang/bin
export PATH
保存退出
Source /etc/profile 让环境变量立即生效
cd /usr/local/erlang/bin
测试erl是否安装成功
erl
退出erl命令行
halt().
安装python
cd ~
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar zvxf Python-2.7.6.tgz -C /usr/local
mv /usr/local/Python-2.7.6 /usr/local/python
cd /usr/local/python
./configure --prefix=/usr/local/python27
make && make install
检测是否安装成功
python -V
xz工具安装
yum install xz
xz -d xxx.tar.xz(此命令为用法,后面需要用到)
tar -xf xxx.tar -C /usr/local(此命令为用法,后面需要用到)

安装RabbitMQ
下载rabbitmq-server-3.6.9.tar.xz
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.9/rabbitmq-server-generic-unix-3.6.9.tar.xz
对rabbitmq包进行解压(解压在当前目录)
xz -d rabbitmq-server-generic-unix-3.6.9.tar.xz
tar -xf rabbitmq-server-generic-unix-3.6.9.tar
随后移动至/usr/local/下 改名rabbitmq
cp -r rabbitmq_server-3.6.9 /usr/local/rabbitmq
这种下载的方式解压后直接可以使用,无需再编译安装
1. 进入到rabbit文件内,其命令文件存在于sbin文件夹下,因此需要将sbin文件夹的路径添加到PATH中:修改/etc/profile

2. export PATH=/usr/local/rabbitmq/sbin:$PATH

3. 执行source /etc/profile使得PATH路径更新,rabbitMQ安装成功。

随后启用MQ管理方式(/usr/local/rabbitmq/sbin)
1. rabbitmq-server -detached #后台运行rabbitmq

可能这步会报错Warning: PID file not written; -detached was passed.
解决
把进程停止了,在再sbin命令,rabbitmq-server start,就一切好了
1. rabbitmq-plugins enable rabbitmq_management #启动后台管理

添加用户和权限
默认网页guest用户是不允许访问的,需要增加一个用户修改一下权限,代码如下:
添加用户:rabbitmqctl add_user admin admin123
添加权限:rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
修改用户角色:rabbitmqctl set_user_tags admin administrator
设置端口号,可供外部访问
iptables -I INPUT -p tcp --dport 15672 -j ACCEPT
然后就可以远程访问了,然后可直接配置用户权限等信息。
firewall-cmd --state
systemctl stop firewalld
systemctl disable firewalld

问题(启动报错)
Warning: PID file not written; -detached was passed.
ERROR: epmd error for host test03: timeout (timed out)
解决:
修改/etc/sysconfig下的network文件:
[root@linux_epm2 ~]# cd /etc/sysconfig
[root@linux_epm2 sysconfig]# vi network

修改hosts文件:
修改/etc下的hosts文件:
[root@linux_epm2 sysconfig]# cd /etc
[root@linux_epm2 etc]# vi hosts

你自己的报错还是要看日志

解决了,是版本问题!RabbitMQ和Erlang需要分别安装相对应的版本才可以!

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!