[rabbitmq-discuss] RabbitMQ Cluster, option "-setcookie cookie" + EC2 experiences

Dmitriy Samovskiy dmitriy.samovskiy at cohesiveft.com
Sun Mar 15 04:42:01 GMT 2009

Hi Alex,

Alex Clemesha wrote:
>>>  Im getting: socket.gaierror: (8, 'nodename nor servname provided, or
>>> not known') when trying to attach a client to second broker (in the
>>> cluster).
>> That looks like an error thrown by the python client library and, on the
>> surface of it, does not appear to indicate a problem with the RabbitMQ
>> broker. Do the connection attempts show up in the server logs at all?
> I've gotten to the root of the problem - it has to do with the fact
> that the second
> rabbit broker is doing a redirect, i.e, from
> /var/log/rabbitmq/rabbit.log I see:
> INFO REPORT==== 14-Mar-2009::00:18:55 ===
> connection <0.16842.0> redirecting to
> <<"domU-12-31-39-00-7E-16.compute-1.internal:5672">>
This name (*.internal) is an
internal DNS name that resolves only in EC2 region where your brokers are running. Clients
connecting from another region (regions are US or EU) or from Internet will not be able to
resolve this - they should be using the instance's public DNS name.

Python on my mac does raise gaierror 8 when I tried to connect to unresolvable name (see 
below). Interestingly, python in Linux raised gaierror -2 'Name or service not known'.

$ python
Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import socket
 >>> sock = socket.socket()
 >>> sock.connect(('foo.bar.internal', 5672))
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "<string>", line 1, in connect
socket.gaierror: (8, 'nodename nor servname provided, or not known')

You *might* get rabbit to put right name into known_hosts field by associating public DNS 
name of rabbit instance (ec2*.amazonaws.com) with its private IP address (10.X.X.X) in 
/etc/hosts. Or do client side load balancing with insist=True, like you said.

Also, here is a link to a potentially related thread:

- Dmitriy

More information about the rabbitmq-discuss mailing list