GithubHelp home page GithubHelp logo

majiajue / rabbitmq-docker-cluster Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oprearocks/rabbitmq-docker-cluster

0.0 0.0 0.0 3 KB

This repository hosts all the files and documentation necessary to run your own RabbitMQ Docker cluster

rabbitmq-docker-cluster's Introduction

Clustering RabbitMQ Docker containers

This repository accompanies a blog article/YouTube video I created to walk people through the setup of a RabbitMQ cluster on their machine. Go to my website to learn more about the setup:

Set up a RabbitMQ cluster on your laptop using Docker

Using docker run

In this section you will learn the commands used to launch a RabbitMQ cluster using the regular docker engine run command.

  1. Start master node:
docker run -d \
    --name="rabbit1" \
    --hostname="rabbit1"\
    -e RABBITMQ_ERLANG_COOKIE="secret string" \
    -e RABBITMQ_NODENAME="rabbit1" \
    --volume=(pwd)/rabbitmq.config:/etc/rabbitmq/rabbitmq.config \
    --volume=(pwd)/definitions.json:/etc/rabbitmq/definitions.json \
    --publish="4369:4369" \
    --publish="5671:5671" \
    --publish="5672:5672" \
    --publish="15671:15671" \
    --publish="15672:15672" \
    --publish="25672:25672" \
    rabbitmq:3-management
  1. Start slave #1:
docker run -d \
    --name="rabbit2" \
    --hostname="rabbit2"\
    -e RABBITMQ_ERLANG_COOKIE="secret string" \
    -e RABBITMQ_NODENAME="rabbit2" \
    --volume=(pwd)/rabbitmq.config:/etc/rabbitmq/rabbitmq.config \
    --volume=(pwd)/definitions.json:/etc/rabbitmq/definitions.json \
    --link="rabbit1:rabbit1" \
    rabbitmq:3-management
  1. Start slave #2:
docker run -d \
    --name="rabbit3" \
    --hostname="rabbit3"\
    -e RABBITMQ_ERLANG_COOKIE="secret string" \
    -e RABBITMQ_NODENAME="rabbit3" \
    --volume=(pwd)/rabbitmq.config:/etc/rabbitmq/rabbitmq.config \
    --volume=(pwd)/definitions.json:/etc/rabbitmq/definitions.json \
    --link="rabbit1:rabbit1" \
    --link="rabbit2:rabbit2" \
    rabbitmq:3-management
  1. View container logs individually
docker logs -f <rabbit#>

This will display the logs for the chosen container, and follow them just like tail -f /log/path would do.

  1. Run producer / consumer

The producer / consumer scripts were created as simple Node.js scripts so they can be executed using regular bash script execution syntax.

Using docker-compose

This section details how to start the whole cluster using docker-compose and a YAML definition file

  1. Create a network shared by all containers
docker network create rabbitmq-cluster
  1. Start cluster:
docker-compose up -d
  1. View logs for all containers
docker-compose logs -f
  1. Run producer / consumer for testing

Same as in the section detailing docker run you can launch the consumer/producer as regular shell scripts.

Create a distributed local cluster

To be continued

Deploying to AWS

To be continued

Deploying to Microsoft Azure

To be continued

Tools

Very useful tool for simulating message circulation in your RabbitMQ setup.

http://tryrabbitmq.com/

rabbitmq-docker-cluster's People

Contributors

oprearocks avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.