datastax/python-driver — pull request #21 by devdave (2013-09-07 00:54:54+00:00)
Title: Override map to connect to remote c* clusters ( eg EC2 ).

I couldn't think of how to make a unit-test for this but its simple enough that I don't think it should have any surprise side-effects.

Idea is that given a node in a cluster with external DNS like "ec2-1-2-3-4.compute-1.amazonaws.com" and internal IP of 10.8.7.6. The internal IP would be in system.peers and given how python-driver works, it would build up its tokenmap and few other resources using that IP which is unfortunately inaccessible to a remote client.

So, something like this:

cluster = cassanda.Cluster(['ec2-1-2-3-4.compute-1.amazonaws.com'])

would become

remotehost_map = {}
remotehost_map['10.8.7.6'] = 'ec2-1-2-3-4.compute-1.amazonaws.com'
cluster = cassanda.Cluster(['ec2-1-2-3-4.compute-1.amazonaws.com'], remotehost_map = remotehost_map)

and that would override the values in system.peers to allow for external communication without a VPN.