##拉取镜像
docker pull rabbitmq:management
##启动3个节点
docker run -d --hostname rabbitmq01 --name rabbitmqCluster01 -v pwd/rabbitmq01:/var/lib/rabbitmq -p 15672:15672 -p 5672:5672 -e RABBITMQ_ERLANG_COOKIE='rabbitmqCookie' rabbitmq:management
docker run -d --hostname rabbitmq02 --name rabbitmqCluster02 -v pwd/rabbitmq02:/var/lib/rabbitmq -p 7002:15672 -p 5673:5672 -e RABBITMQ_ERLANG_COOKIE='rabbitmqCookie' --link rabbitmqCluster01:rabbitmq01 rabbitmq:management
docker run -d --hostname rabbitmq03 --name rabbitmqCluster03 -v pwd/rabbitmq03:/var/lib/rabbitmq -p 8002:15672 -p 5674:5672 -e RABBITMQ_ERLANG_COOKIE='rabbitmqCookie' --link rabbitmqCluster01:rabbitmq01 --link rabbitmqCluster02:rabbitmq02 rabbitmq:management
##创建rabbitmq集群
docker exec -it rabbitmqCluster02 bash
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl join_cluster --ram rabbit@rabbitmq01
rabbitmqctl start_app
rabbitmqctl cluster_status
docker exec -it rabbitmqCluster03 bash
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl join_cluster --ram rabbit@rabbitmq01
rabbitmqctl start_app
rabbitmqctl cluster_status