其他分享
首页 > 其他分享> > Deployment Of RabbitMQ Cluster Within Docker

Deployment Of RabbitMQ Cluster Within Docker

作者:互联网

1. install RabbitMQ by pulling images of RabbitMQ

  #docker pull rabbitmq:management

2. create network

  #docker network create rabbtimanet

3. create 3 sections

rabbitmq1:

docker run -d --name=rabbitmq1 -p 5672:5672 -p 15672:15672 -e RABBITMQ_NODENAME=rabbitmq1 -e RABBITMQ_ERLANG_COOKIE='YZSDHWMFSMKEMBDHSGGZ' -h rabbitmq1 --net=rabbtimanet rabbitmq:management

rabbitmq2:

docker run -d --name=rabbitmq2 -p 5673:5672 -p 15673:15672 -e RABBITMQ_NODENAME=rabbitmq2 -e RABBITMQ_ERLANG_COOKIE='YZSDHWMFSMKEMBDHSGGZ' -h rabbitmq2 --net=rabbtimanet rabbitmq:management

rabbitmq3:

docker run -d --name=rabbitmq3 -p 5674:5672 -p 15674:15672 -e RABBITMQ_NODENAME=rabbitmq3 -e RABBITMQ_ERLANG_COOKIE='YZSDHWMFSMKEMBDHSGGZ' -h rabbitmq3 --net=rabbtimanet rabbitmq:management

4. add to cluster

#docker exec -it 247e80f63f88 bash
#rabbitmqctl stop_app
#rabbitmqctl reset
#rabbitmqctl join_cluster --ram rabbitmq1@rabbitmq1
#rabbitmqctl start_app
#exit

#docker exec -it c94262eb82dd bash
#rabbitmqctl stop_app
#rabbitmqctl reset
#rabbitmqctl join_cluster --ram rabbitmq1@rabbitmq1
#rabbitmqctl start_app
#exit

 

 5. testing -> add one piece of data to each node, the data will sync to each other

 

标签:--,rabbitmq1,Within,rabbitmq3,RABBITMQ,Cluster,rabbitmqctl,Docker,docker
来源: https://www.cnblogs.com/kevin-xk/p/15063683.html