Cluster in Docker Swarm

174 views
Skip to first unread message

Nuno Centeio

unread,
Feb 21, 2021, 12:35:55 PM2/21/21
to rabbitmq-users
Hi guys,

I hope someone can help me with this. I'm very new to Rabbit and also to Docker. All my previous experiments were with Kubernetes and it is working.

I have the challenge of making RabbitMQ to work in a Docker Swarm cluster.
Seems that I'm unable to make other nodes to be able to connect to the cluster.

This is my YAML file:
version: '3.3'

services:
  rabbitmq:
    image: rabbitmq:3-management
    hostname: "{{.Node.Hostname}}"
    deploy:
      mode: global
      endpoint_mode: dnsrr
    environment:
      - RABBITMQ_DEFAULT_USER=admin
      - RABBITMQ_DEFAULT_PASS=password
      - RABBITMQ_ERLANG_COOKIE=foobar
      - RABBITMQ_USE_LONGNAME=true
    ports:
      - mode: host
        target: 25672
        published: 25672
      - mode: host
        target: 15672
        published: 15672
      - mode: host
        target: 5672
        published: 5672
      - mode: host
        target: 4369
        published: 4369
    volumes:
      - /etc/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf
    networks:
      - myoverlay

networks:
  myoverlay:

I have a two node swarm. What happens is that each node is working as standalone.
The logs of the second node says this:
2021-02-21 17:25:48.013 [info] <0.273.0> Configured peer discovery backend: rabbit_peer_discovery_dns
2021-02-21 17:25:48.013 [info] <0.273.0> Will try to lock with peer discovery backend rabbit_peer_discovery_dns
2021-02-21 17:25:48.013 [info] <0.273.0> Peer discovery backend does not support locking, falling back to randomized delay
2021-02-21 17:25:48.013 [info] <0.273.0> Peer discovery backend rabbit_peer_discovery_dns does not support registration, skipping randomized startup delay.
2021-02-21 17:25:48.014 [info] <0.273.0> Addresses discovered via A records of rabbitmq: 10.0.5.21, 10.0.5.35
2021-02-21 17:25:48.015 [info] <0.273.0> Addresses discovered via AAAA records of rabbitmq:
2021-02-21 17:25:48.015 [info] <0.273.0> All discovered existing cluster peers: rabbit@Docker02, rabbit@rabbit_rabbitmq.c9om15ttphfhecnlt2emrgrkv.k7097ajjj4hf34z2vh6wl1wm0.rabbit_myoverlay
2021-02-21 17:25:48.016 [info] <0.273.0> Peer nodes we can cluster with: rabbit@rabbit_rabbitmq.c9om15ttphfhecnlt2emrgrkv.k7097ajjj4hf34z2vh6wl1wm0.rabbit_myoverlay
2021-02-21 17:25:48.023 [warning] <0.273.0> Could not auto-cluster with node rabbit@rabbit_rabbitmq.c9om15ttphfhecnlt2emrgrkv.k7097ajjj4hf34z2vh6wl1wm0.rabbit_myoverlay: {badrpc,nodedown}
2021-02-21 17:25:48.023 [error] <0.273.0> Trying to join discovered peers failed. Will retry after a delay of 500 ms, 9 retries left...
(...)
2021-02-21 17:25:53.104 [warning] <0.273.0> Could not successfully contact any node of: rabbit@rabbit_rabbitmq.c9om15ttphfhecnlt2emrgrkv.k7097ajjj4hf34z2vh6wl1wm0.rabbit_myoverlay (as in Erlang distribution). Starting as a blank standalone node...

This name, I saw him when I do a "docker ps" on the first machine:
sudo docker ps
CONTAINER ID   IMAGE                                                  COMMAND                   CREATED          STATUS          PORTS                                                                                                                                      NAMES
4be2c8283477   rabbitmq:3-management                                  "docker-entrypoint.s…"    11 minutes ago   Up 11 minutes   0.0.0.0:4369->4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 0.0.0.0:15672->15672/tcp, 0.0.0.0:25672->25672/tcp, 15691-15692/tcp   rabbit_rabbitmq.c9om15ttphfhecnlt2emrgrkv.k7097ajjj4hf34z2vh6wl1wm0

Also, I have other questions. It seems that when the container starts it will try to join the cluster and, when the node is unavaiable it continues as standalone. This is not cool because of scaling. I want to be able to scale up and down machines and they need to join the cluster.

Anyone can give me an hint of what I am doing wrong?

Thanks

Nuno Centeio

unread,
Feb 28, 2021, 3:13:30 AM2/28/21
to rabbitm...@googlegroups.com
Hi,

No one to help me?

Thanks


--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/8R-Qur8H0l8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/532260d0-b3fd-472b-ad8d-c71e9684a0b3n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages