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.

  • Access docker.sock from inside a container
  • How to edit file after I shell to a docker container?
  • Docker Windows bridge ip conflict
  • Rename file in docker container
  • curl Flask web service inside Docker container
  • Should Docker be used in a non devops, not very agile environment? [closed]
  • 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.

  • Where are TLS certificates stored for Docker on Windows Server 2016 TP3
  • Keepalived/Haproxy docker-compose connection refused
  • Fig support on Boot2Docker / Windows platform
  • Docker: “lstat no such file or directory” error when building image. File is there
  • How to define a variable in a Dockerfile?
  • how to detach from a docker container
  • 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.