Docker容器

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

 

这篇关于Deployment Of RabbitMQ Cluster Within Docker的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!