Question about running rabbitmq cluster in docker

427 views
Skip to first unread message

Hechen Gao

unread,
Jun 1, 2016, 4:47:42 PM6/1/16
to rabbitmq-users
Hi rabbitmq users,

I am trying to run rabbitmq cluster in docker, the docker container scheduling is done through another tool, so the docker container might land in a different slave with docker daemon installed.\

I managed to get rabbitmq nodes cluster work manually, by putting the public ip address plug docker container id in the /etc/hosts file. And now i am trying to automate this process.

The question i am having is: how to change the rabbitmq hostname within docker container? By default, when running rabbitmq in docker, the rabbitmq nodes looks like this: rabbit@[container id]. Considering there will be multiple physical slaves, i cannot know the docker container id if it landed on a different slave.

I tried to update $RABBITMQ_HOSTNAME in the containers, but i am getting errors saying: unable to set short name. If I have $RABBITMQ_LONG_NAME=true set, i am getting errors saying: unable to set long name.

If i try to run the following command:

container1 > rabbitmqctl join_cluster rabbit@[public ip of container 2]

I will get the following error, which looks like the erlang process cannot do distribution because the hostname doesn't match.
  * connected to epmd (port 4369) on [public ip of container 2]
  * epmd reports node 'rabbit' running on port 25672
  * TCP connection succeeded but Erlang distribution failed
  * suggestion: hostname mismatch?
  * suggestion: is the cookie set correctly?
  * suggestion: is the Erlang distribution using TLS?

So what kind of configuration do i need to to in order to be able to make rabbitmq cluster with each other using the public ip.

Hechen Gao

unread,
Jun 1, 2016, 4:48:51 PM6/1/16
to rabbitmq-users
The rabbitmq server version i am running is 3.6.2.

Karl Nilsson

unread,
Jun 2, 2016, 4:04:14 AM6/2/16
to rabbitm...@googlegroups.com
The -h flag to the docker run command will let you set the container hostname, which may help if your provisioning tool allows you to specify it.

You may want to check out https://github.com/aweber/rabbitmq-autocluster which helps you automatically manage cluster membership.

Cheers
Karl



--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Karl Nilsson

Staff Software Engineer, Pivotal/RabbitMQ
Reply all
Reply to author
Forward
0 new messages