Skip to content

RabbitMQ Resources

This directory contains resources for working with RabbitMQ in Docker, including guides and configuration files.

Files in this Directory

  • rabbitmq-cluster.md: Detailed guide on setting up a RabbitMQ cluster with Docker
  • .env: Environment variables for the RabbitMQ Docker configuration
  • docker-compose.yml: Docker Compose configuration for running RabbitMQ
  • rabbitmq.conf: RabbitMQ configuration file with persistence settings
  • enabled_plugins: List of plugins to enable on all nodes
  • setup-rabbitmq-cluster.sh: Script to set up and configure cluster nodes
  • health-check.sh: Script to verify cluster health
  • backup-rabbitmq.sh: Script to back up cluster definitions

Quick Start

To run a single RabbitMQ instance for development:

bash
docker-compose up -d

This will start a RabbitMQ container with the management plugin enabled.

Management UI

Access the RabbitMQ Management UI at:

http://localhost:15672

Default credentials:

  • Username: guest
  • Password: guest

Testing Your RabbitMQ Instance

Publish a Message

bash
docker exec -it rabbitmq1 rabbitmqadmin declare queue name=test_queue durable=true
docker exec -it rabbitmq1 rabbitmqadmin publish exchange=amq.default routing_key=test_queue payload="Hello, RabbitMQ!"

Consume a Message

bash
docker exec -it rabbitmq1 rabbitmqadmin get queue=test_queue

Viewing Logs

bash
# View container logs
docker logs rabbitmq1

# Follow logs in real-time
docker logs -f rabbitmq1

Setting Up a Cluster

For production or testing high availability features, you can set up a RabbitMQ cluster using the provided files. See the RabbitMQ Clustering Guide for detailed instructions.

Quick Cluster Setup

bash
# Create the required network
docker network create rabbitmq-cluster

# Start the cluster
docker-compose up -d

# Set up the cluster (join nodes and configure HA)
./setup-rabbitmq-cluster.sh

Persistence Features

The cluster is configured with enhanced persistence features:

  1. Volume Mounts: Each node has dedicated volumes for both data and configuration
  2. Restart Policy: All containers have restart: unless-stopped for automatic recovery
  3. Quorum Queues: Default queue type set to quorum queues for better data safety
  4. HA Policies: Automatic configuration of high availability policies
  5. Backup System: Regular backups using the provided script

Monitoring Cluster Health

bash
./health-check.sh

Backing Up Cluster Configuration

bash
./backup-rabbitmq.sh

Cluster Management UI Access

  • Node 1: http://localhost:15672
  • Node 2: http://localhost:15673
  • Node 3: http://localhost:15674

Default credentials:

  • Username: admin
  • Password: admin

Resources