Skip to content
No description or website provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

RabbitMQ cluster with Docker Compose

Creates a 3 node RabbitMQ cluster with a HAProxy acting as a load balancer.

You need to build the HAProxy image first, just run:

$ docker build -t haproxy-rabbitmq-cluster:1.7 .

Now run the docker compose file:

$ docker-compose up -d

check if the containers are running:

$ docker ps

Create the cluster by running:

$ docker exec -ti rabbitmq-node-2 bash -c "rabbitmqctl stop_app"
$ docker exec -ti rabbitmq-node-2 bash -c "rabbitmqctl join_cluster rabbit@rabbitmq-node-1"
$ docker exec -ti rabbitmq-node-2 bash -c "rabbitmqctl start_app"

$ docker exec -ti rabbitmq-node-3 bash -c "rabbitmqctl stop_app"
$ docker exec -ti rabbitmq-node-3 bash -c "rabbitmqctl join_cluster rabbit@rabbitmq-node-1"
$ docker exec -ti rabbitmq-node-3 bash -c "rabbitmqctl start_app"

Check the cluster status:

$ docker exec -ti rabbitmq-node-1 bash -c "rabbitmqctl cluster_status"

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 admin:Admin@123.

You can’t perform that action at this time.