cd /usr/local/
mkdir rabbitmq
cd rabbitmq
mkdir 1
mkdir 2
mkdir 3
cd 1
mkdir lib
mkdir log
chmod 777 lib
chmod 777 log
Note: 1.2.3 node file directory consistency
Installation commands
docker pull rabbitmq:management
docker run -d --hostname rabbitmq_host1 --name rabbitmq1 -p 15672:15672 -p 5672:5672 -e RABBITMQ_NODENAME=rabbit -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=xxx333.78 -e RABBITMQ_ERLANG_COOKIE='rabbitmq_cookie' --privileged=true -v /usr/local/rabbitmq/1/lib:/var/lib/rabbitmq -v /usr/local/rabbitmq/1/log:/var/log/rabbitmq rabbitmq:management
docker run -d --hostname rabbitmq_host2 --name rabbitmq2 -p 15673:15672 -p 5673:5672 --link rabbitmq1:rabbitmq_host1 -e RABBITMQ_NODENAME=rabbit -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=xxx333.78 -e RABBITMQ_ERLANG_COOKIE='rabbitmq_cookie' --privileged=true -v /usr/local/rabbitmq/2/lib:/var/lib/rabbitmq -v /usr/local/rabbitmq/2/log:/var/log/rabbitmq rabbitmq:management
docker run -d --hostname rabbitmq_host3 --name rabbitmq3 -p 15674:15672 -p 5674:5672 --link rabbitmq1:rabbitmq_host1 --link rabbitmq2:rabbitmq_host2 -e RABBITMQ_NODENAME=rabbit -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=xxx333.78 -e RABBITMQ_ERLANG_COOKIE='rabbitmq_cookie' --privileged=true -v /usr/local/rabbitmq/3/lib:/var/lib/rabbitmq -v /usr/local/rabbitmq/3/log:/var/log/rabbitmq rabbitmq:management
4. 3 nodes are up and configuring the cluster
docker exec -it rabbitmq1 bash
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl start_app
exit
docker exec -it rabbitmq2 bash
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl join_cluster --ram rabbit@rabbitmq_host1
rabbitmqctl start_app
exit
docker exec -it rabbitmq3 bash
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl join_cluster --ram rabbit@rabbitmq_host1
rabbitmqctl start_app
exit
5. Open the web terminal http:ip:port number/15672, the master node to create a queue for testing