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 configurationdocker-compose.yml: Docker Compose configuration for running RabbitMQrabbitmq.conf: RabbitMQ configuration file with persistence settingsenabled_plugins: List of plugins to enable on all nodessetup-rabbitmq-cluster.sh: Script to set up and configure cluster nodeshealth-check.sh: Script to verify cluster healthbackup-rabbitmq.sh: Script to back up cluster definitions
Quick Start
To run a single RabbitMQ instance for development:
bash
docker-compose up -dThis 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_queueViewing Logs
bash
# View container logs
docker logs rabbitmq1
# Follow logs in real-time
docker logs -f rabbitmq1Setting 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.shPersistence Features
The cluster is configured with enhanced persistence features:
- Volume Mounts: Each node has dedicated volumes for both data and configuration
- Restart Policy: All containers have
restart: unless-stoppedfor automatic recovery - Quorum Queues: Default queue type set to quorum queues for better data safety
- HA Policies: Automatic configuration of high availability policies
- Backup System: Regular backups using the provided script
Monitoring Cluster Health
bash
./health-check.shBacking Up Cluster Configuration
bash
./backup-rabbitmq.shCluster Management UI Access
- Node 1:
http://localhost:15672 - Node 2:
http://localhost:15673 - Node 3:
http://localhost:15674
Default credentials:
- Username: admin
- Password: admin