Pycassa ConnectionPool won't accept IP address?

458 views
Skip to first unread message

Tony Li

unread,
Jul 15, 2013, 7:28:02 PM7/15/13
to pycassa...@googlegroups.com
Hi all,
I'm new to pycassa, so this question maybe a bit silly. I have a problem when making connectionPool. It works with "localhost" and 127.0.0.1 but doesn't work with other IP address.
Following the example in the documentation I tried pool = ConnectionPool(keyspace='keySpace_s1', server_list=['149.165.158.159:9160'], prefill=False) and it seemed to work, but it will give the same error when I use columnFamily as this: columnFamily = pycassa.ColumnFamily(pool, 'ColumnFamily1')
I'm not sure where the problem is
Any help and tips are appreciated!

Thanks,
-Tony 

The errors are:

>>> import pycassa
>>> pool = ConnectionPool('keySpace_s1', ['localhost:9160']) # it works fine
>>> pool = ConnectionPool('keySpace_s1', ['127.0.0.1:9160']) # it works fine too
>>> pool = ConnectionPool('keySpace_s1', ['10.1.2.13:9160']) #this is the IP for the same machine, didn't work
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/pycassa-1.7.2-py2.4.egg/pycassa/pool.py", line 361, in __init__
    self.fill()
  File "/usr/lib/python2.4/site-packages/pycassa-1.7.2-py2.4.egg/pycassa/pool.py", line 422, in fill
    conn = self._create_connection()
  File "/usr/lib/python2.4/site-packages/pycassa-1.7.2-py2.4.egg/pycassa/pool.py", line 408, in _create_connection
    raise AllServersUnavailable('An attempt was made to connect to each of the servers ' +
pycassa.pool.AllServersUnavailable: An attempt was made to connect to each of the servers twice, but none of the attempts succeeded. The last failure was TTransportException: Could not connect to 10.1.2.13:9160

Tyler Hobbs

unread,
Jul 16, 2013, 11:04:51 AM7/16/13
to pycassa...@googlegroups.com
I have some broken fingers, so I'll be brief.  Check firewalls and make sure rpc_address is 0.0.0.0 or 10.x.x.x.x in cassandra.yaml.  Test with telnet from the client machine.


--
You received this message because you are subscribed to the Google Groups "pycassa-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pycassa-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Tyler Hobbs
DataStax

Tony Li

unread,
Jul 16, 2013, 12:04:28 PM7/16/13
to pycassa...@googlegroups.com
Thanks Tyler,
You're right, after setting the rpc address to be 0.0.0.0 and listen address to be private IP, I did get access.
I forgot to mention that I was using cloud environment. It's a private cloud, and after those setting I can access from another machine in the cloud. But I still can't access from outside of the cloud with public IP. With public IP Cassandra won't start and bind the address. I did some Googling, but all I found is to use a tool provided by Amazon, but my cloud is not EC2, although it follows EC2 interface.

Thanks,
-Tony


--
You received this message because you are subscribed to a topic in the Google Groups "pycassa-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pycassa-discuss/1xaaXLMiOtk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pycassa-discu...@googlegroups.com.

Tyler Hobbs

unread,
Jul 17, 2013, 11:23:58 AM7/17/13
to pycassa...@googlegroups.com
At least with EC2, use the private IP for listen_address, and use the public IP for the connection pool if the client is outside of EC2.

Baal Su

unread,
Sep 19, 2014, 10:09:14 AM9/19/14
to pycassa...@googlegroups.com
Hi Tyler, 
    Your reply solves my problem, I have been struggling a long time, thanks very much.
Reply all
Reply to author
Forward
0 new messages