码迷,mamicode.com
首页 > 其他好文 > 详细

RabbitMQ集群搭建

时间:2019-10-16 13:33:10      阅读:61      评论:0      收藏:0      [点我收藏+]

标签:echo   clust   class   cut   ble   service   nis   地址   open   

RabbitMQ集群搭建

##CentOS7.2
##RabbitMQ 3.6.5

####所有节点运行 下面命令
cat >/etc/yum.repos.d/CentOS-OpenStack-liberty.repo <<EOF
[centos-openstack-liberty]    
name=CentOS-7 - OpenStack liberty     
baseurl=http://vault.centos.org/centos/7.3.1611/cloud/x86_64/openstack-liberty/
gpgcheck=0     
enabled=1     
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Centos-7
EOF
###
yum install -y rabbitmq-server

systemctl enable rabbitmq-server.service
systemctl restart rabbitmq-server.service

rabbitmqctl  add_user admin admin
rabbitmqctl  set_user_tags admin administrator

rabbitmqctl add_user openstack 123456
rabbitmqctl change_password openstack 123456
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
rabbitmqctl set_user_tags openstack administrator

rabbitmq-plugins list 
rabbitmq-plugins enable rabbitmq_management  
netstat -tnlp|grep beam


####所有节点执行命令  群集配置,/var/lib/rabbitmq/.erlang.cookie文件内容必须一致
echo $(echo 123456 |md5sum |cut -d   -f1) >/var/lib/rabbitmq/.erlang.cookie
systemctl restart rabbitmq-server.service
netstat -tnlp|grep beam

########

######其它节点运行,主节点不用运行
rabbitmqctl stop_app
rabbitmqctl join_cluster rabbit@ops171
rabbitmqctl start_app
rabbitmqctl cluster_status 

####此时 node2 与 node3 也会自动建立连接;如果要使用内存节点,则可以使用
####rabbitmqctl join_cluster --ram rabbit@ops232

#更改群集名称
###rabbitmqctl set_cluster_name RabbitMQ-Cluster 

#查看群集状态
rabbitmqctl cluster_status 

###访问RabbitMQ,访问地址是http://ip:15672

 

RabbitMQ集群搭建

标签:echo   clust   class   cut   ble   service   nis   地址   open   

原文地址:https://www.cnblogs.com/blog-lhong/p/11684837.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!