rabbitmq3.6.6安装,环境centos7

Posted 冰壶的博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了rabbitmq3.6.6安装,环境centos7相关的知识,希望对你有一定的参考价值。

环境:centos7
附上安装脚本 ,附上官网地址 http://www.rabbitmq.com/ ,从这上面可以下载rabbitmq-server-3.6.6-1.el7.noarch.rpm包
#/bin/bash 
SRC_URI="https://github.com/rabbitmq/rabbitmq-server/releases/download/rabbitmq_v3_6_6/rabbitmq-server-3.6.6-1.el7.noarch.rpm"
PKG_NAME=`basename $SRC_URI`
DIR=`pwd`
DATE=`date +%Y%m%d%H%M%S`
 
yum install -y erlang.x86_64
yum install -y socat.x86_64
 
if [ ! -s $PKG_NAME ]; then
wget -c $SRC_URI
fi
rpm -ivh rabbitmq-server-3.6.6-1.el7.noarch.rpm
 
service rabbitmq-server start #启动
rabbitmqctl add_user admin adminpasswd #设置密码
rabbitmqctl set_user_tags admin administrator
rabbitmq-plugins enable rabbitmq_management
 
if ! cat /etc/rc.d/rc.local | grep ‘service rabbitmq-server start‘ &> /dev/null;then
echo "service rabbitmq-server start" >> /etc/rc.d/rc.local
fi #加入开机启动
chmod +x /etc/rc.d/rc.local  #centos7里面默认这个文件没有执行权限
 
 
访问rabbitmq的网址ip:15672
 
可以网页了,进行登录,大功告成!
 
问题:
rabbitmq启动报错
Feb 20 18:30:09 test rabbitmqctl[822]: attempted to contact: [[email protected]]
Feb 20 18:30:09 test rabbitmqctl[822]: [email protected]:
Feb 20 18:30:09 test rabbitmqctl[822]: * unable to connect to epmd (port 4369) on test: address (cannot connect to host/port)
Feb 20 18:30:09 test rabbitmqctl[822]: current node details:
Feb 20 18:30:09 test rabbitmqctl[822]: - node name: ‘[email protected]
Feb 20 18:30:09 test rabbitmqctl[822]: - home dir: .
Feb 20 18:30:09 test rabbitmqctl[822]: - cookie hash:xxxxxxxxxxxxx==
Feb 20 18:30:09 test systemd[1]: Failed to start RabbitMQ broker.
Feb 20 18:30:09 test systemd[1]: Unit rabbitmq-server.service entered failed state.
Feb 20 18:30:09 test systemd[1]: rabbitmq-server.service failed.
解决:
在/etc/hosts里添加主机名解析
 运行如下命令即可
sed -i s/"127.0.0.1 localhost"/"127.0.0.1 localhost `hostname`"/g /etc/hosts  #解释:将/etc/hosts 里的127.0.0.1 localhos字段替换成127.0.0.1 localhost `本机主机名`
 
附上centos7查看所有已启动的服务的命令
systemctl list-units --type=service
 

以上是关于rabbitmq3.6.6安装,环境centos7的主要内容,如果未能解决你的问题,请参考以下文章

rabbitmq3.6.6源码安装

centos6.5 安装rabbitMQ3.6.6

CentOS6.5中配置Rabbitmq3.6.6集群方案

rabbitmq运行异常

Linux Centos7部署环境安装-CentOS

centos7 安装python虚拟环境