RabbitMQ集群搭建
Posted blog-lhong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RabbitMQ集群搭建相关的知识,希望对你有一定的参考价值。
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集群搭建的主要内容,如果未能解决你的问题,请参考以下文章