skip to Main Content

I am using Docker and ubuntu VMs to try and do clustering across different VMs in the same virtual network.

Both machines return the correct value when I run "hostname":
vm1: mqtttest1
vm2: mqtttest2

In the rabbitmq.conf, I thus set the nodes like this:

cluster_name=rabbitcluster
cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config
cluster_formation.classic_config.nodes.1 = rabbit@mqtttest1
cluster_formation.classic_config.nodes.2 = rabbit@mqtttest2

and then the respective startup commands for the docker instances:

vm1: docker run -p 15672:15672 -p 5672:5672 -p 4369:4369 -p 1883:1883 -p 80:80 -e RABBITMQ_NODENAME=rabbit@mqtttest1 -e RABBITMQ_ERLANG_COOKIE=RABBITCLUSTERTEST clustertest


vm2: docker run -p 15672:15672 -p 5672:5672 -p 4369:4369 -p 1883:1883 -p 80:80 -e RABBITMQ_NODENAME=rabbit@mqtttest2 -e RABBITMQ_ERLANG_COOKIE=RABBITCLUSTERTEST clustertest

where "clustertest" is the docker build that includes the rabbitmq.conf file with the above clustering values set.

Both instances startup fine and run independently. However, I get the following error when trying to cluster:

 Could not auto-cluster with node rabbit@mqtttest2: {badrpc,nodedown}
OR
 Could not auto-cluster with node rabbit@mqtttest1: {badrpc,nodedown}

pinging the hostnames seems fine, I get responses. As far as I can tell, everything is configured properly and I can access the management console of each of the RabbitMQ instances using their public IP without issue.

2

Answers


  1. Chosen as BEST ANSWER

    Answer: HUGE thanks to Luke Bakken - I didn't expose port 25672 After I changed startup to include -p 25672:25672 for the "docker run" command, it connected up without any problems.


  2. I have a complete docker compose project that shows how to create a RabbitMQ cluster –

    https://github.com/lukebakken/docker-rabbitmq-cluster

    If you have questions, please start a discussion there –

    https://github.com/lukebakken/docker-rabbitmq-cluster/discussions


    NOTE: Team RabbitMQ monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search