首页 > 代码库 > rabbitmq3.6.6安装,环境centos7
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: [rabbit@test]
Feb 20 18:30:09 test rabbitmqctl[822]: rabbit@test:
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: ‘rabbitmq-cli-76@test‘
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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。