This is how the sample cluster looks on my machine, this is a typical cluster described in the RabbitMQ clustering guide available here - https://www.rabbitmq.com/clustering.html. As recommended at the site, there are 2 disk based nodes and 1 RAM based node here.
To quickly replicate this, you only need to have fig in your machine, just create a fig.yml file with the following entry:
rabbit1: image: bijukunjummen/rabbitmq-server hostname: rabbit1 ports: - "5672:5672" - "15672:15672" rabbit2: image: bijukunjummen/rabbitmq-server hostname: rabbit2 links: - rabbit1 environment: - CLUSTERED=true - CLUSTER_WITH=rabbit1 - RAM_NODE=true rabbit3: image: bijukunjummen/rabbitmq-server hostname: rabbit3 links: - rabbit1 - rabbit2 environment: - CLUSTERED=true - CLUSTER_WITH=rabbit1
and in the folder holding this file, run:
fig up
That is it!, the entire cluster should come up. If you need more nodes, just modify the fig.yml file.
The docker files for creating the dockerized rabbitmq-server is available at my github repo here: https://github.com/bijukunjummen/docker-rabbitmq-cluster and the "rabbitmq-server" image itself is here at the docker hub.
References:
- The base rabbitmq image is somewhat based on cthulhuology's docker rabbitmq image: https://github.com/cthulhuology/docker-rabbitmq
- Docker file: https://github.com/bijukunjummen/docker-rabbitmq-cluster
- Docker image: https://registry.hub.docker.com/u/bijukunjummen/rabbitmq-server/
Appreciate this, makes a lot of sense.
ReplyDeleteQuestion though, how would you add new cluster nodes to this 3 container build if the additional containers were hosted on a different server (LAN)? Can this build be configured for clustering over LAN instead of container links?