Using rabbitmqctl with ip address

2,118 views
Skip to first unread message

tomcat

unread,
Sep 27, 2017, 2:01:55 PM9/27/17
to rabbitmq-users
Hi,
I have a use case where i don't have any dns server availbale and I also don't want to extend my /etc/hosts,
 thus I want to cluster my rabbitMQ nodes using ip addresses instead of hostnames.
I.e., instead of "rabbitmqctl join_cluster rabbit@host55", I want to use "rabbitmqctl join_cluster rab...@192.168.56.55"

From what I read is that this is not possible out of the box? Is this true?
When I try it, it is indeed not working.

where it is said that this feature might be possible in later versions of rabbitMQ.

Can you please provide me with reliable information whether this is possible or not and how I have to configure rabbitMQ in case it is doable.

Thanke :-)

Michael Klishin

unread,
Sep 27, 2017, 4:20:47 PM9/27/17
to rabbitm...@googlegroups.com
Your only option is INETRC: http://erlang.org/doc/apps/erts/inet_cfg.html.

It modifies hostname resolution rules and can effectively replace /etc/hosts.
It’s an Erlang VM feature and obviously won’t affect hostname resolution for any
other process.

You cannot use IP addresses unless they resolve to themselves as hostnames.
--
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.

Luke Bakken

unread,
Sep 27, 2017, 6:48:51 PM9/27/17
to rabbitmq-users
Hello,

It appears that you can use IP addresses when you use the following two variables in /etc/rabbitmq/rabbitmq-env.conf

RABBITMQ_USE_LONGNAME=true
RABBITMQ_NODENAME=rab...@10.0.50.50

Note that you'll probably have to create the rabbitmq-env.conf file as it doesn't exist by default. If you had started RabbitMQ prior to making these changes, the previous configuration stored in /var/lib/rabbitmq will no longer be valid.

All nodes in your cluster must use these settings with unique IP addresses, of course, that must match the host's IP address. Don't forget to ensure all nodes are using the same value in /var/lib/rabbitmq/.erlang.cookie

I tested the above settings by creating two virtual machines using Vagrant and VirtualBox (the other box used 10.0.50.51):

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/xenial64"
  config.vm.hostname = "UBUNTU-16"
  config.vm.network "private_network", ip: "10.0.50.50"
end

The private network allows communication between the two nodes. After setting up Erlang 20, RabbitMQ 3.6.12, the Erlang cookie, and then clustering the nodes, it appears to be working fine:

root@UBUNTU-16-2:~# rabbitmqctl cluster_status
Cluster status of node 'rab...@10.0.50.51'
[{nodes,[{disc,['rab...@10.0.50.50','rab...@10.0.50.51']}]},
 {running_nodes,['rab...@10.0.50.50','rab...@10.0.50.51']},
 {cluster_name,<<"rabbit@UBUNTU-16-2">>},
 {partitions,[]},
 {alarms,[{'rab...@10.0.50.50',[]},{'rab...@10.0.50.51',[]}]}]

Please give this a try and let me know how it works in your environment.

Thanks,
Luke

Adrien

unread,
May 6, 2018, 2:23:22 PM5/6/18
to rabbitmq-users
Hi Luke,

Just tried your solution, works fine in rmq 3.6 but not in 3.7 any idea ?

Regards

Michael Klishin

unread,
May 7, 2018, 1:39:52 AM5/7/18
to rabbitm...@googlegroups.com
We do not guess on this list. Please provide server logs, CLI tool logs and everything
else you feel relevant that can help others help you.

--
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

kkasa...@manh.com

unread,
Sep 7, 2018, 3:45:03 PM9/7/18
to rabbitmq-users
Hi,
In  my experience, using IP address as a folder name is the worst idea.. Especially when clustering and if the data store is a persistent volume.
If a node goes down and a new node is started with same name , but different IP address , the MNESIA data store now has two folders with different IP address based names and any back/restore scripts that are written will be worthless.
Can you suggest a way to aut-cluster rabbitmq in kubernetes using only hostnames ?
thanks,
KK
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,
Sep 11, 2018, 7:47:54 AM9/11/18
to rabbitm...@googlegroups.com
This list uses one thread for one question.

Database directory location can be changed [1].
There is a peer discovery doc guide that covers more or less everything
there is related to Kubernetes [2].

Using hostnames in Kubernetes peer discovery is orthogonal to using a hostname
(or even a constant path, e.g. /var/lib/rabbitmq/data) for the data directory.


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