RabbitMQ Node name

766 views
Skip to first unread message

Gunjan Thapliyal

unread,
Apr 4, 2018, 12:59:35 AM4/4/18
to rabbitmq-users
Hi

I have deployed rabbitmq to multiple nodes and I see the nodename being generated containing the container id. Say 695f54784fa5.
The complete nodename is rabbit@695f54784fa5.

I use the RABBITMQ_NODENAME to specify my own value for the nodename. Say mynodename. The value actually changes to 
mynodename@695f54784fa5

I want to avoid using the container id and specify my own value as the node name for complete control. This is to avoid a case when two containers on the different nodes have the same id (coincidentally). In that I case fear forming a cluster between the nodes will be an issue as I see nodename in the command to form a rabbitmq cluster
rabbitmqctl join_cluster rabbit@695f54784fa5
Two independent nodes may have the same container id and node name

Is there a way I can specify my own node name in order to avoid conflicts later?
Is there another way to form the cluster instead of using the nodename which is getting out of my control?

Thanks
Gunjan

Michael Klishin

unread,
Apr 4, 2018, 3:16:07 AM4/4/18
to rabbitm...@googlegroups.com
RABBITMQ_NODENAME is the way to change node name. Note RABBITMQ_USE_LONGNAME
as well [1].

By default the hostname part of node name is obtained from the current hostname. RabbitMQ is not aware
of container IDs or anything of that kind.

The only requirement for node names is that they are

 * Resolvable from all node names [2]
 * Stable (or fixed using the above env variables)

[3][4] can be relevant here.

4. http://erlang.org/doc/apps/erts/inet_cfg.html plus search list archives for "inetrc"


--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Gunjan Thapliyal

unread,
Apr 4, 2018, 5:26:48 AM4/4/18
to rabbitmq-users
The container id is being used instead of hostname when deployed as docker containers. This is what I observe.

How do I ensure that two containers running on two different nodes do not have the same nodename, (as this is not the network hostname in case of containers)? There is a posibility of a conflict when the two RabbitMQ containers running on the two nodes need to join teh cluster.

Thanks
Gunjan
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.

Michael Klishin

unread,
Apr 4, 2018, 5:40:19 AM4/4/18
to rabbitm...@googlegroups.com
> How do I ensure that two containers running on two different nodes do not have the same nodename

This is outside of the scope of RabbitMQ and arguably this list. Use any strategy and tooling you find suitable to
make sure the containers get unique, resolvable hostnames. That's something I'd expect container orchestration tools
to take care of.


To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Gunjan Thapliyal

unread,
Apr 4, 2018, 8:39:08 AM4/4/18
to rabbitmq-users
Makes sense. May be docker swarm can help me here. 
I also expected rabbitmq to have a property to control the complete node name and not just the username. Of course, that if done will also need the inter-node networking and routing carefully using the property value. May be hard to do rabbit is designed.

Thanks
Gunjan

Michael Klishin

unread,
Apr 4, 2018, 6:20:41 PM4/4/18
to rabbitm...@googlegroups.com
RABBITMQ_NODENAME "controls" the node name and since it's just an environment variable,
it should be reasonably easy to override in most Docker-based deployment environments.

To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages