I want to set up 2 rabbitmq servers to work in cluster. When when trying to run
rabbitmqctl join_cluster rabbit@my_rabbit_1.my.domain.name on my_rabbit_1
I get unable to connect to epmd (port 4369) on my_rabbit_2.my.domain.name: nxdomain (non-existing domain)
I use rabbitmq:latest (debian), .erlang.cookie is the same, hosts resolve fine: I can ping both directions, nmap -6 -p 4369 my_rabbit_2.my.domain.nam returns 4369/tcp open epmd
EDIT:
tcpdump shows that while resolving hostname, rabbit or epmd performs not 2 types of DNS query: AAAA for IPv6 and A for IPv4 address, but only IPv4 which fails repeatedly with nxdomain as there is no IPv4 address available. However, it does not try AAAA DNS query, except when trying to run command like rabbitmq -n [email protected]: then it runs AAAA query and outputs successfully. Hence the problem. How do I solve that?
Finally found solution that worked for me. Erlang documentation says that, by default,
-proto_distspecifies a protocol for Erlang distribution, which defaults toinet_tcp(TCP over IPv4). So in IPv6-only environment you have to set-proto_dist inet6_tcpflag forerl.This can be done by adding the following lines to your
rabbitmq-env.conf(see RabbitMQ configuration docs):Note that
rabbitmqctlandrabbitmq-serveruse differenterlsettings: I was unable to create cluster withoutRABBITMQ_CTL_ERL_ARGS="-proto_dist inet6_tcp"setting usingrabbitmqctl join_cluster [email protected]. It should not be necessary in production mode. Also note that RabbitMQ configuration docs advice against using this setting except for debugging.