谷粒商城创建Rabbitmq集群(二十六)

369、集群-RabbitMQ-镜像集群搭建

docker run -d --hostname rabbitmq01  --name rabbitmq01 -v /mydata/rabbitmq/rabbitmq01:/var/lib/rabbitmq  -p 15672:15672 -p 5672:5672 -e RABBITMQ_ERLANG_COOKIE=‘dalianpai‘ rabbitmq:management

[ ~]# docker run -d --hostname rabbitmq02  --name rabbitmq02 -v /mydata/rabbitmq/rabbitmq02:/var/lib/rabbitmq  -p 15674:15672 -p 5674:5672 -e RABBITMQ_ERLANG_COOKIE=‘dalianpai‘ --link rabbitmq01:rabbitmq01  rabbitmq:management
ae25c092e6f5cadd37f8ac6b4ed76aaab04a43605aaf3d739d8e053148b8cf4c
You have mail in /var/spool/mail/root



[ mail]# docker run -d --hostname rabbitmq03  --name rabbitmq03 -v /mydata/rabbitmq/rabbitmq03:/var/lib/rabbitmq  -p 15675:15672 -p 5675:5672 -e RABBITMQ_ERLANG_COOKIE=‘dalianpai‘ --link rabbitmq01:rabbitmq01  --link rabbitmq02:rabbitmq02  rabbitmq:management
2ca59e853b3908f0e368bf7f3ce8368b6e180993169b6ab388d5056a8a5535a0
[ mail]# docker ps -a



[ mail]# docker exec -it rabbitmq01 /bin/bash
:/# rabbitmqctl stop_app
Stopping rabbit application on node  ...
:/# rabbitmqctl reset
Resetting node  ...
:/# rabbitmqctl start_app
Starting node  ...
:/#

[ mail]# docker exec -it rabbitmq02 /bin/bash
:/# rabbitmqctl stop_app
Stopping rabbit application on node  ...
:/# rabbitmqctl reset
Resetting node  ...
:/# rabbitmqctl join_cluster --ram 
Clustering node  with 
:/# rabbitmqctl start_app
Starting node  ...
:/# exit
exit



[ mail]# docker exec -it rabbitmq03 /bin/bash
:/# rabbitmqctl stop_app
Stopping rabbit application on node  ...
:/# rabbitmqctl reset
Resetting node  ...
:/# rabbitmqctl join_cluster --ram 
Clustering node  with 
:/#  rabbitmqctl start_app
Starting node  ...
:/# exit
exit
[ mail]#


[ mail]# docker exec -it rabbitmq01 /bin/bash
:/# rabbitmqctl set_policy -p / ha "^" ‘{"ha-mode":"all","ha-sync-mode":"automatic"}‘                                                          Setting policy "ha" for pattern "^" to "{"ha-mode":"all","ha-sync-mode":"automatic"}" with priority "0" for vhost "/" ...
:/# rabbitmqctl  list_policies -p /
Listing policies for vhost "/" ...
vhost   name    pattern apply-to        definition      priority
/       ha      ^       all     {"ha-mode":"all","ha-sync-mode":"automatic"}

谷粒商城创建Rabbitmq集群(二十六)

相关推荐