Disclosure up front: I run IPYE, a company that leases IP space. This is a practical how-to, and IPYE comes up where it helps, with a short call to action at the end.
RabbitMQ has two kinds of network traffic. AMQP clients connect on port 5672 or 5671, and cluster nodes talk to each other over Erlang distribution. AMQP over IPv6 needs only a listener setting. Erlang distribution over IPv6 needs an extra flag, and clusters without it fail in confusing ways. This guide covers both, for nodes numbered from a free IPv6 /48 from IPYE. The examples use the documentation prefix 2001:db8:100::/48, with nodes rmq1 to rmq3 at 2001:db8:100:16::1 to ::3.
Names must resolve to IPv6
Erlang identifies nodes by name, for example rabbit@rmq1. Each node has to resolve the others' short hostnames to their IPv6 addresses. Use DNS or /etc/hosts on every node:
2001:db8:100:16::1 rmq1 2001:db8:100:16::2 rmq2 2001:db8:100:16::3 rmq3 Turn on inet6 for distribution
In /etc/rabbitmq/rabbitmq-env.conf:
SERVER_ADDITIONAL_ERL_ARGS="-kernel inetrc '/etc/rabbitmq/erl_inetrc' -proto_dist inet6_tcp" RABBITMQ_CTL_ERL_ARGS="-proto_dist inet6_tcp" And /etc/rabbitmq/erl_inetrc:
{inet6, true}. -proto_dist inet6_tcp makes Erlang distribution use IPv6. The CLI tools need the same flag, which is what RABBITMQ_CTL_ERL_ARGS provides. Without it, rabbitmqctl can't reach the node and reports that the node is down even when it's running. The inetrc file makes Erlang's resolver return IPv6 addresses.
AMQP and management listeners
In rabbitmq.conf:
listeners.tcp.1 = :::5672 listeners.ssl.1 = :::5671 management.tcp.port = 15672 management.tcp.ip = :: :::5672 means all IPv6 addresses (::) on port 5672. To bind to one address, write listeners.tcp.1 = 2001:db8:100:16::1:5672. RabbitMQ splits the port off after the last colon.
epmd
The Erlang port mapper daemon (epmd) listens on port 4369 and tells nodes which port each Erlang node is using. Make sure it listens on IPv6 too:
ERL_EPMD_ADDRESS=::,127.0.0.1 Set it in the systemd unit or socket for epmd, or in rabbitmq-env.conf, then check:
ss -ltnp | grep -E '4369|25672|5672' Port 25672 is the distribution port, 20000 higher than the AMQP port by default.
Form the cluster
Copy the same Erlang cookie (/var/lib/rabbitmq/.erlang.cookie) to every node, then on rmq2 and rmq3:
rabbitmqctl stop_app rabbitmqctl join_cluster rabbit@rmq1 rabbitmqctl start_app rabbitmqctl cluster_status cluster_status should list all three running nodes. If join_cluster reports nodedown, check name resolution first, then the -proto_dist flag on both server and CLI, then the firewall.
Firewall
ip6 saddr 2001:db8:100:16::/64 tcp dport { 4369, 25672 } accept ip6 saddr 2001:db8:100:17::/64 tcp dport { 5671, 5672 } accept ip6 saddr 2001:db8:100:10::/64 tcp dport 15672 accept Keep epmd and distribution limited to cluster members. Anyone who can reach port 25672 and knows the cookie can run code on the node.
Clients
Most AMQP client libraries accept a bracketed IPv6 address in the URI, amqps://user:pass@[2001:db8:100:16::1]:5671/vhost, or a hostname with AAAA records. Use quorum queues for anything you can't afford to lose. They replicate across nodes and tolerate one node going down in a three-node cluster.
Why stable node addresses help
Erlang clusters are sensitive to hostname and address changes. Using a prefix you announce yourself means you can move the nodes between providers without rebuilding the cluster. IPYE's free /48 comes with a LOA and an automatically created ROA.
Next step
Claim your free /48 in the IPYE portal, add -proto_dist inet6_tcp for both server and CLI, and form the cluster.
About IPYE
IPYE leases IPv4, IPv6 and ASN space with instant setup. Your first IPv6 /48 is free for the first year, a real allocation you can announce on your own ASN, with a LOA from the portal and the ROA created automatically. IPv4 /24 to /22 leases include LOA, ROA and per-/24 rDNS, and ASN and region changes apply automatically. Locations: Los Angeles, New York, Ashburn, Salt Lake City, London, Amsterdam, Frankfurt. More at ipye.com. Questions: ipye@turnel.com.
Disclosure: I run IPYE
