4

I have an issue when trying to enable clustering using the official RabbitMQ Docker image - https://hub.docker.com/_/rabbitmq/. I'm using docker-compose to start my infrastructure, and I cannot get the "slave" nodes to join the cluster. When I run rabbitmqctl cluster_status on the master, the slaves are not listed.

Here is the output of rabbitmqctl cluster_status:

$ docker-compose exec master-rabbitmq bash
root@master-rabbitmq:/# rabbitmqctl cluster_status
Cluster status of node 'rabbit@master-rabbitmq' ...
[{nodes,[{disc,['rabbit@master-rabbitmq']}]},
 {running_nodes,['rabbit@master-rabbitmq']},
 {cluster_name,<<"rabbit@master-rabbitmq">>},
 {partitions,[]},
 {alarms,[{'rabbit@master-rabbitmq',[]}]}]

My docker-compose.yml is listed below, for reference.

version: "2"
services:
  master-rabbitmq:
      image: rabbitmq:3-management
      hostname: master-rabbitmq
      environment:
        - RABBITMQ_ERLANG_COOKIE=super secret token
      ports:
        - "4369:4369"
        - "5671:5671"
        - "5672:5672"
        - "15671:15671"
        - "15672:15672"
        - "25672:25672"

  slave1-rabbitmq:
      image: rabbitmq:3-management
      hostname: slave1-rabbitmq
      links:
        - "master-rabbitmq:master-rabbitmq"
      environment:
        - RABBITMQ_ERLANG_COOKIE=super secret token

  slave2-rabbitmq:
      image: rabbitmq:3-management
      hostname: slave2-rabbitmq
      links:
        - "master-rabbitmq:master-rabbitmq"
      environment:
        - RABBITMQ_ERLANG_COOKIE=super secret token
Adrian Oprea
  • 2,360
  • 3
  • 21
  • 23

1 Answers1

2

You will likely have to run

rabbitmqctl join_cluster rabbit@master-rabbitmq

On each of the slave nodes

  • Thanks a lot! So ignorant of me not to add the video I created after I found the solution: https://youtu.be/w2kGd2VRJWE . – Adrian Oprea May 17 '18 at 05:43
  • There's a problem that the containers need to be able to identify each other by host name and so that was also part of why my setup did not work. – Adrian Oprea May 17 '18 at 05:44