RabbitMQ Cluster does not elect new master

I have set up a RabbitMQ cluster with 3 nodes: rabbit1, rabbit2 and rabbit3, each of these is running in a docker container.

All queues are mirrored among the three nodes and rabbit1 is the master. When I stop the container for rabbit2 or rabbit3 the two remaining nodes work fine. If I have, say, 3 messages in a queue these still exist on rabbit1 and the other node that is still up.

  • Docker Hub automated build failure. Local build is fine
  • linux machine using on docker for windows
  • How to set a var for a Docker-compose file?
  • Docker: adding a file from a parent directory
  • How to access docker container via its Ip from the host
  • Docker Error : no space left on device on windows
  • However, if I stop rabbit1, the queues of rabbit2 and rabbit3 are emptied until i start rabbit1 again. If I send a message to rabbit2 or rabbit3, the message is received but not saved into the queue; whereas when rabbit1 is up and I send something to rabbit2 / rabbit3, the message gets saved and is synchronized correctly.

    Is there any way or any configuration that I need to consider so that the message aren’t emptied from the slaves when the master is shut down, but the slaves elect a new master instead or at least keep the messages saved?
    Thank you very much in advance.

  • How to run maven test with mysql running in docker
  • Not able to access Kibana running in a Docker container on port 5601
  • “Error response from daemon: Cannot start container … no such file or directory” on Oracle Linux running hello-world
  • at command inside docker container
  • How to deliver dockerized app to client?
  • Docker Apache Proxy point to running Python Script
  • 2 Solutions collect form web for “RabbitMQ Cluster does not elect new master”

    Setting up the cluster is one thing, but you also need to configure queue mirroring. By default, queues are not replicated on other nodes: you need to explicitly indicate which queue(s) must be replicated and how, using policies.

    The RabbitMQ documentation linked above as examples for several use cases.

    So I’ve found the problem:

    I declare the queue within my code, and even though rabbitmq does “count” these queues they do not appear under the management and for example can neither be viewed with “rabbitmqctl list_queues”.

    If I declare the queue via the UI or via rabbitmqadmin and let the service connect to the already existing queue it works fine.

    I wonder though, why the queues to not appear in the management tool, even though they obviously exist somewhere (since I can read / push).

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