RabbitMQ ipv6 DNS names Solved

Last week I was building up a RabbitMQ cluster with shovel from New York to Los Angeles. As we use a dual stack environment ipv4/v6, I expected that RabbitMQ would resolve the ipv6 address  first as normal Linux systems do. So I begun to do my tests and realized, that it didn’t.

My publisher  (see code below) sends messages to the following host: “‘rabbitmq0.domb.net‘”

from amqplib import client_0_8 as amqp
import sys

conn = amqp.Connection('rabbitmq0.domb.net', userid="logger", password="test", virtual_host="/", insist=False)
chan = conn.channel()

for i in range(1000):
#msg = amqp.Message(sys.argv[1])
sendmsg = "paket ny:" + str(i)
msg = amqp.Message(sendmsg)
msg.properties["delivery_mode"] = 2
chan.basic_publish(msg,exchange="incoming_orders",routing_key="warehouse")
chan.close()
conn.close()

Executing that code I got the following error:

{{badmatch,{error,econnrefused}},
[{rabbit_shovel_worker,make_conn_and_chan,1},
{rabbit_shovel_worker,handle_cast,2},
{gen_server2,handle_msg,2},
{proc_lib,init_p_do_apply,3}]}

It looked like rabbit does not get the ipv6 address back. To be sure I looked at the DNS logs and traced the request with tcpdump and got the confirmation that it resolve ipv4 addresses first. So I was wondering what if I add an ipv6 address does it work?

Here an example with a ipv6 address:

from amqplib import client_0_8 as amqp
import sys

conn = amqp.Connection('[2625:103:2012::205a]:5672', userid="logger", password="test", virtual_host="/", insist=False)
chan = conn.channel()

for i in range(1000):
#msg = amqp.Message(sys.argv[1])
sendmsg = "paket ny:" + str(i)
msg = amqp.Message(sendmsg)
msg.properties["delivery_mode"] = 2
chan.basic_publish(msg,exchange="incoming_orders",routing_key="warehouse")
chan.close()
conn.close()

Yes it does.

As I need ipv6 and couldn’t find the code where the erlang parameter gets passed I wrote to the RabbitMQ mailing list.

http://comments.gmane.org/gmane.comp.networking.rabbitmq.general/18437

And got a fast response and a fix from Emile Joubert from rabbitmq 4 days later. Thank you very much!!!  Will test the patch this week.

Here is the patch

http://hg.rabbitmq.com/rabbitmq-erlang-client/rev/7f53561c0c11

If you don’t know howto rebuild the rpm you can have mine until the official comes out. Use it at your own risk!

rabbitmq-server-2.8.6-1fixipv6.el6.noarch.rpm

Leave a Reply

Your email address will not be published. Required fields are marked *

*


Hit Counter provided by laptop reviews