Skip to content

duonghd7/hd-docker-rabbitmq-cluster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RabbitMQ cluster with HAProxy and Docker Compose

image

1. Create file

haproxy.cfg
Dockerfile
docker-compose.yml

2. Build haproxy-server

docker build -t haproxy-server .

3. Rundocker

docker-compose -f docker-compose.yml up

4. Create cluster RabbisMQ

a: Stop child node
docker exec -ti rabbitmq-node-2 bash -c "rabbitmqctl stop_app"
docker exec -ti rabbitmq-node-3 bash -c "rabbitmqctl stop_app"
b: Join child node to main node
docker exec -ti rabbitmq-node-2 bash -c "rabbitmqctl join_cluster rabbit@rabbitmq-node-1"
docker exec -ti rabbitmq-node-3 bash -c "rabbitmqctl join_cluster rabbit@rabbitmq-node-1"
c: Start child node
docker exec -ti rabbitmq-node-2 bash -c "rabbitmqctl start_app"
docker exec -ti rabbitmq-node-3 bash -c "rabbitmqctl start_app"

Access HAProxy statistics report at http://localhost:1936/haproxy?stats with the credential haproxy:haproxy, and the RabbitMQ console at http://localhost:15672/# with the credential root:1234567.