Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

RabbitMQ DNS Discovery doesn't recognise itself

264 views
Skip to first unread message

Mat Jaggard

unread,
Feb 22, 2023, 2:39:12 PM2/22/23
to rabbitmq-users
I'm having trouble setting up DNS Discovery because my reverse DNS doesn't return the correct hostname. I'm not sure how to fix that because my reverse DNS always returns a name of the form `ip-10-10-10-10`.

I have however managed to get my cluster up and running by specifying node names like this:
export MYIP=`ifconfig eth0 | grep 'inet' | awk '{print $2}'`
export NEW_HOSTNAME=`dig -x $MYIP +short | cut -d'.' -f1`
export RABBITMQ_NODENAME=rabbit@$NEW_HOSTNAME
export RABBITMQ_MNESIA_DIR=/var/lib/rabbitmq/mnesia/rabbit@$HOSTNAME

I have one remaining issue which is that when my first node starts up, it looks up the shared entry in DNS and finds itself but the name doesn't match because the node knows its own name so doesn't perform a reverse DNS I think. I get a long delay while it fails to connect to `rabbit@myrealhost` instead of `rabbit@ip-10-10-10-10`. The subsequent nodes start up correctly.

Surely if Rabbit is going to insist on using reverse DNS it should use it consistently? Or better not use reverse DNS at all but have a way of requesting the node name from a node if I have the correct cookie?

Many thanks,
Mat.

Mat Jaggard

unread,
Feb 23, 2023, 2:47:46 AM2/23/23
to rabbitmq-users
Oh, I was wrong. It doesn't work. Later when a node failed and restarted I got an error about the cluster being in an inconsistent state (again because nodes don't know their own names correctly)

Mahendra Rathod

unread,
Feb 23, 2023, 2:26:59 PM2/23/23
to rabbitm...@googlegroups.com
Hi Mat,

Nice to see you here in the group. Here is what found on the internet. See if it works for you. With these steps, each node in the RabbitMQ cluster should be able to perform reverse DNS lookup correctly and retrieve its own hostname. This should enable the cluster to function correctly and avoid any inconsistencies or delays during startup.

1. Set up the hosts file on each node to map the IP address to the hostname. This can be done by editing the /etc/hosts file and adding a line for each node in the cluster. For example:

10.0.0.1 node1.example.com
10.0.0.2 node2.example.com
10.0.0.3 node3.example.com

2. Set the hostname of each node to the fully qualified domain name (FQDN) that was specified in the hosts file. This can be done by running the following command on each node:

sudo hostnamectl set-hostname node1.example.com

3. Enable reverse DNS lookup on each node by editing the /etc/resolv.conf file and adding the following line:

options single-request-reopen

4. Set up DNS resolution for the cluster by creating a DNS A record for each node in the cluster. For example:

node1.example.com     A      10.0.0.1
node2.example.com     A      10.0.0.2
node3.example.com     A      10.0.0.3

5. Configure RabbitMQ to use the fully qualified domain name (FQDN) for the node name instead of the IP address. This can be done by setting the RABBITMQ_NODENAME environment variable in the RabbitMQ configuration file to the FQDN of the node. For example:

RABBITMQ_NODENAME=rab...@node1.example.com

6. Start the RabbitMQ service on each node and verify that they are all running and able to communicate with each other.

Kind regards,
Mahendra Rathod.


--
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 view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/e9277309-6892-41c9-8daa-1a8ea9145f34n%40googlegroups.com.

Mat Jaggard

unread,
Feb 23, 2023, 5:21:24 PM2/23/23
to rabbitm...@googlegroups.com
Hi Mahendra,
Thanks for taking the time to look into this, however I can't do most of those steps.

Firstly when my containers start I don't know about the other containers that will be starting in the future.

Secondly I don't want to give full capabilities to the container which means I can't change the host name after it's started (and my orchestration layer gives very limited options for host name at start up).

My DNS can correctly resolve the hostnames in question but it seems that reverse lookups always end up at AWS somehow.

I hope you're well.

Many thanks,
Mat.


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/zoajC0W-QW8/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/CAAx61X5mV0yq%2BUsiM%2BxExUyD18NqDrPEJPSKO6kd-oKmnn1TOg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages