GitHub - TempGROX/babylon-RabbitMQ · GitHub
Skip to content

TempGROX/babylon-RabbitMQ

Folders and files

Repository files navigation

RabbitMQ Deployment Guide

1. Prerequisites

Before proceeding with the RabbitMQ setup, ensure that the following prerequisites are met:

  • Docker & Docker Compose: Install Docker and Docker Compose on your server. RabbitMQ will be deployed as a Docker container.
  • Proper System Configuration: Ensure your system has sufficient memory (at least 1GB of RAM is recommended) and disk space.
  • Firewall Configuration: Open the necessary ports on your firewall. The default ports for RabbitMQ are:
    • 5672: For the RabbitMQ client connections.
    • 15672: For the RabbitMQ Management Plugin (optional, but recommended).

2. Create a Docker Compose File

The easiest way to deploy RabbitMQ is by using Docker Compose. First, create a directory where your configuration files will be stored, then create a Docker Compose YAML file in this directory.

mkdir rabbitmq-deployment
cd rabbitmq-deployment
nano docker-compose.yml

Copy the following content into the docker-compose.yml file:

version: '3'
services:
  rabbitmq:
    image: rabbitmq:3-management
    container_name: rabbitmq
    ports:
      - "5672:5672"   # RabbitMQ client port
      - "15672:15672" # Management plugin port (web UI)
    volumes:
      - rabbitmq_data:/var/lib/rabbitmq
    environment:
      RABBITMQ_DEFAULT_USER: admin   # Set the default username
      RABBITMQ_DEFAULT_PASS: password   # Set the default password
volumes:
  rabbitmq_data:

Explanation of the file:

  • Image: We're using rabbitmq:3-management, which comes pre-configured with the RabbitMQ management plugin.
  • Ports: We map ports 5672 (for client connections) and 15672 (for the management UI) to the same ports on the host machine.
  • Environment: Define a default username and password to access RabbitMQ.

3. Start RabbitMQ

With the docker-compose.yml file set up, you can now start the RabbitMQ container. From within the rabbitmq-deployment directory, run the following command:

docker-compose up -d

This will pull the RabbitMQ Docker image if it isn’t already on your system and start the container in the background.

Verify the container is running:

To check if RabbitMQ is up and running, you can use:

docker ps

You should see the rabbitmq container in the list of running containers.

4. Access RabbitMQ Management UI

Once the RabbitMQ container is up and running, you can access the management interface by opening your browser and navigating to:

http://<your_server_ip>:15672

Log in using the credentials defined in the docker-compose.yml file (admin and password by default).

5. Customizing RabbitMQ Configuration

If you need to further customize your RabbitMQ setup, such as adding plugins or configuring queues, you can edit the RabbitMQ configuration file.

Create a new file called rabbitmq.conf in your deployment directory:

nano rabbitmq.conf

Then define any custom settings you need. For example:

# Enable the RabbitMQ management plugin
management.listener.port = 15672

You can then mount this file into your RabbitMQ container by adding the following to your docker-compose.yml:

volumes:
  - ./rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf

Once you've updated the configuration, restart the container:

docker-compose down
docker-compose up -d

6. Scaling RabbitMQ

To scale RabbitMQ for a production environment, you may want to configure it in a cluster. Here's a brief overview of how to add clustering to RabbitMQ:

  1. Create Multiple Instances: Modify the docker-compose.yml file to define multiple RabbitMQ instances.
  2. Configure the Cluster: Add the necessary configurations for clustering, such as defining the cluster nodes.
  3. Enable Persistent Storage: Ensure that your RabbitMQ data is stored persistently using Docker volumes.

This part would require deeper configurations and a detailed setup depending on your specific needs.

7. Monitoring and Logs

Logs for the RabbitMQ container can be accessed using the following command:

docker logs rabbitmq

You can also view metrics and monitor the health of RabbitMQ through the management UI (accessible at port 15672).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors