RabbitMQ Cluster in Docker Container among different hosts

I want to create a rabbitMQ cluster that is very resilient to failures.

So far I’ve managed to create a cluster with three nodes, each of these nodes runs inside a docker container. To enable the nodes to join a cluster, the hosts needs to know each other via links.

  • How does the microservice API gateway pattern work with auto Horizontal scaling?
  • Docker build “no such file or directory” but work with docker-compose
  • Docker and netstat: netstat is not showing ports, exposed by docker containers
  • Docker: Client Server Program each running as a Container Not Able to Communicate with each Other Using POSIX Socket API
  • Cannot run JHipster docker
  • Why would I need to run docker privileged to access host log4j2.yaml
  • Now, the whole architecture runs in the cloud (on AWS to be precise). So far, my containers can only be linked with one another, when they run on the same AWS-instance. I want to create the cluster in a way that nodes can lie on diffrent hosts.

    So far I’ve tried:

    1. Using federation / shovel instead. This does not serve my purpose, because I need CP from the CAP-Theorem and not CA. I need my nodes to be all replicas of one another and to be able to act as the same broker to clients.

    2. Creating a docker swarm. I am able to set-up the docker swarm and connect two instances via docker swarm. But if I try to run multiple rabbit-containers on this swarm, they either are placed on the same node or I cannot link them with one another. So I end up with the same constellation, of all my hosts running on the same node.

    Is there any solution or other approach, with which I could create a rabbitmMQ-cluster inside docker containers among different AWS-instances / hosts?

  • How to restore postgres within a docker?
  • Docker (under boot2docker) does not look for/find local images when building
  • Docker CMD weirdness when ENTRYPOINT is a shell script
  • Running Cloudant as docker container with docker compose
  • Escaping double curly braces in Ansible
  • Trying to connect to Ammonite sshd when app is running in docker container
  • One Solution collect form web for “RabbitMQ Cluster in Docker Container among different hosts”

    You mentioned “To enable the nodes to join a cluster, the hosts needs to know each other via links” .. but I’m not sure why you require the links. The main thing is for each of the containers to be able to locate each other, which is basically a service discovery problem. I’ve done something similar (with rabbitmq) using consul on a bunch of different VMs (not even using swarm), but if you’re already running a swarm cluster then you might be able to hit the API to discover other instances of the container?

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.