Giter Club home page Giter Club logo

rabbitmq-cluster-docker-compose's Introduction

HAProxy and RabbitMQ cluster with Docker Compose

Creates a 3 node RabbitMQ cluster with a HAProxy acting as a load balancer.

You need to build the HAProxy image first, just run:

$ docker build -t roofimon/haproxy-rabbitmq-cluster:2.3 .

Now run the docker compose file:

$ docker-compose up -d

check if the containers are running:

$ docker ps

Create the cluster by running:

$ docker exec -ti rabbitmq-node-2 bash -c "rabbitmqctl stop_app"
$ docker exec -ti rabbitmq-node-2 bash -c "rabbitmqctl join_cluster rabbit@rabbitmq-node-1"
$ docker exec -ti rabbitmq-node-2 bash -c "rabbitmqctl start_app"

$ docker exec -ti rabbitmq-node-3 bash -c "rabbitmqctl stop_app"
$ docker exec -ti rabbitmq-node-3 bash -c "rabbitmqctl join_cluster rabbit@rabbitmq-node-1"
$ docker exec -ti rabbitmq-node-3 bash -c "rabbitmqctl start_app"

Check the cluster status:

$ docker exec -ti rabbitmq-node-1 bash -c "rabbitmqctl cluster_status"

Options for more resilience

Declares a policy which matches the queues whose names begin with "two." are mirrored to any two nodes in the cluster, with automatic synchronisation:

$ docker exec -ti rabbitmq-node-3 bash -c 'rabbitmqctl set_policy ha-two "^two\." "{\"ha-mode\":\"exactly\",\"ha-params\":2,\"ha-sync-mode\":\"automatic\"}"'

Declares a policy which matches the queues whose names begin with "test_" and configures mirroring to all nodes in the cluster:

$ docker exec -ti rabbitmq-node-3 bash -c 'rabbitmqctl set_policy ha-all "^test\_" "{\"ha-mode\":\"all\"}"'

Access HAProxy statistics report at

http://localhost:1936/haproxy?stats` with the credential `haproxy:haproxy`

RabbitMQ console at

http://localhost:15672/` with the credential `admin:Admin@123`.

rabbitmq-cluster-docker-compose's People

Contributors

roofimon avatar joao-osilva avatar roof42 avatar

Watchers

James Cloos 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.