Skip to content
Cluster RabbitMQ (official docker image)
Python Shell
Branch: master
Clone or download
Pull request Compare This branch is 2 commits ahead of pardahlman:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Cluster RabbitMQ 🐰

Based on:


> git clone
> cd docker-rabbitmq-cluster
> docker-compose up

Most things will be how you expect:

  • The default username and password are guest/guest
  • The broker accepts connections on localhost:5672
  • The Management interface is found at localhost:15672

Additionally each container exposes the broker AMQP and MGMT interface port at:

  • 5672+(container no)
  • 15672+(container no) respectively.

E.g. rabbitmq1 can be reached at 5673 (5672+1) for AMQP and 15673 (15672+1) for the Management interface.


The .env file

The .env file contains:

  1. RABBITMQ_ERLANG_COOKIE environment variable that can be used to change the Erlang cookie.
  2. RABBITMQ_DOCKER_TAG environment variable that can be used to change the RabbitMQ Docker image tag. By default it is set to 3.8-management.

The config/rabbitmq.conf

Configuration of the broker is exposed via this file.

The config/advanced.config

Advanced configuration of the broker is exposed by this file (empty by default).

The config/enabled_plugins

Enabled plugins can be changed via this file.


With rabbitmqadmin tool

Make sure the RabbitMQ cluster is running. Then get the rabbitmqadmin tool:

curl http://localhost:15672/cli/rabbitmqadmin -o rabbitmqadmin
chmod u+x rabbitmqadmin

Then declare a queue, publish some message and get that message from a queue:

./rabbitmqadmin declare queue name=my_queue
./rabbitmqadmin publish routing_key=my_queue payload=szkolarabbita
./rabbitmqadmin get queue=my_queue ackmode=ack_requeue_false

Now using the Management Plugin one can see stats for the my_queue to see that the message really went through it: http://localhost:15672/#/queues/%2F/my_queue

NOTE: When using the rabbitmqadmin all the interactions with broker go through the HTTP API exposed by the Management Plugin.

With Python snippets

Make sure the RabbitMQ cluster is running. Then install python dependencies:

NOTE: For this to work you need to have pipenv installed.

cd python/ && pipenv install

Then once you are in the python/ directory start a consumer and attach it to a another_queue:

pipenv run python --queue another_queue
# => [*] Waiting for messages. To exit press CTRL+C

Then publish a message to our queue:

pipenv run python --queue another_queue --message hello
# => [x] Sent 'hello'

Finally, you can check the another_queue stats at http://localhost:15672/#/queues/%2F/another_queue.


To stop and remove the containers run:

docker-compose down
You can’t perform that action at this time.