docker pull rabbitmq:3.9.5-management
docker run -d --hostname rabbitmq1.com --name rabbitmq1 -v F:/workspace/dockerimage/rabbitmq/rabbitmq1:/var/lib/rabbitmq -p 15672:15672 -p 5672:5672 -e RABBITMQ_ERLANG_COOKIE='rabbitmqcookie' rabbitmq:3.9.5-management docker run -d --hostname rabbitmq2.com --name rabbitmq2 -v F:/workspace/dockerimage/rabbitmq/rabbitmq2:/var/lib/rabbitmq -p 15673:15672 -p 5673:5672 -e RABBITMQ_ERLANG_COOKIE='rabbitmqcookie' --link rabbitmq1:rabbitmq1.com rabbitmq:3.9.5-management docker run -d --hostname rabbitmq3.com --name rabbitmq3 -v F:/workspace/dockerimage/rabbitmq/rabbitmq3:/var/lib/rabbitmq -p 15674:15672 -p 5674:5672 -e RABBITMQ_ERLANG_COOKIE='rabbitmqcookie' --link rabbitmq1:rabbitmq1.com --link rabbitmq2:rabbitmq2.com rabbitmq:3.9.5-management
节点1
docker exec -it rabbitmq1 bash rabbitmqctl stop_app rabbitmqctl reset rabbitmqctl start_app exit
节点2
docker exec -it rabbitmq2 bash rabbitmqctl stop_app rabbitmqctl reset rabbitmqctl join_cluster --ram rabbit@rabbitmq1com rabbitmqctl start_app exit
节点3
docker exec -it rabbitmq3 bash rabbitmqctl stop_app rabbitmqctl reset rabbitmqctl join_cluster --ram rabbit@rabbitmq1com rabbitmqctl start_app exit