openstack pike + ceph +高可用集成 -- RabbitMQ Cluster (五)
################################ #RabbitMQ Cluster群集安装配置 #rabbitmqctl手工配置集群,Disk node,镜像模式 #centos7 #RabbitMQ Cluster 安装群集 所有controller节点 yum install rabbitmq-server erlang socat -y systemctl start rabbitmq-server.service rabbitmq-plugins enable rabbitmq_management #启动web插件端口15672 netstat -antp|egrep '567' #controller1节点 #拷贝到其它节点,统一认证的Erlang Cookie scp /var/lib/rabbitmq/.erlang.cookie controller2:/var/lib/rabbitmq/ scp /var/lib/rabbitmq/.erlang.cookie controller3:/var/lib/rabbitmq/ #rabbitmqctl status #使用Disk模式 systemctl stop rabbitmq-server.service pkill beam.smp rabbitmqctl stop rabbitmq-server -detached rabbitmqctl cluster_status #查看状态 #controller2、controller3执行加入节点controller1 systemctl stop rabbitmq-server.service pkill beam.smp rabbitmq-server -detached rabbitmqctl stop_app rabbitmqctl join_cluster rabbit@controller1 rabbitmqctl start_app rabbitmqctl cluster_status # #任意一个节点上执行 rabbitmqctl set_policy ha-all "^" '{"ha-mode":"all"}' #设置镜像队列 rabbitmqctl set_cluster_name RabbitMQ-Cluster #更改群集名称 rabbitmqctl cluster_status #查看群集状态 #成功 [root@controller1 ~]# rabbitmqctl cluster_status #查看群集状态 Cluster status of node rabbit@controller1 ... [{nodes,[{disc,[rabbit@controller1,rabbit@controller2,rabbit@controller3]}]}, {running_nodes,[rabbit@controller3,rabbit@controller2,rabbit@controller1]}, ' {cluster_name,<<"RabbitMQ-Cluster">>},' {partitions,[]}, {alarms,[{rabbit@controller3,[]}, {rabbit@controller2,[]}, {rabbit@controller1,[]}]}] #重置: rabbitmqctl stop_app ; rabbitmqctl reset #rabbitmq-plugins list #查看支持的插件 #systemctl restart rabbitmq-server.service ################################ #以下为openstack高可用相关的配置 #haproxy设置……所有controller节点 echo '#RabbitMQ listen RabbitMQ-Server bind controller:5673 mode tcp balance roundrobin option tcpka timeout client 3h timeout server 3h option clitcpka server controller1 controller1:5672 check inter 5s rise 2 fall 3 server controller2 controller2:5672 check inter 5s rise 2 fall 3 server controller3 controller3:5672 check inter 5s rise 2 fall 3 listen RabbitMQ-Web bind controller:15673 mode tcp balance roundrobin option tcpka server controller1 controller1:15672 check inter 5s rise 2 fall 3 server controller2 controller2:15672 check inter 5s rise 2 fall 3 server controller3 controller3:15672 check inter 5s rise 2 fall 3 '>>/etc/haproxy/haproxy.cfg systemctl restart haproxy.service netstat -antp|grep 567 #访问RabbitMQ,访问地址是http://ip:15672 #其中一节点,添加用户及密码 rabbitmqctl add_user admin admin rabbitmqctl set_user_tags admin administrator rabbitmqctl add_user openstack openstack rabbitmqctl set_permissions openstack ".*" ".*" ".*" rabbitmqctl set_user_tags openstack administrator systemctl restart rabbitmq-server.service netstat -antp|grep '5672'