Using an ELB to front Cassandra Cluster in AWS

983 views
Skip to first unread message

Lahiru

unread,
May 12, 2016, 7:49:02 PM5/12/16
to DataStax Java Driver for Apache Cassandra User Mailing List
Hi Users,

I have a scenario where I want to expose my private Cassandra Cluster to external application, so I configured an ELB (secured the ELB only to accessed by my application instance) and attached all my Cassandra nodes as listeners and opened the two the ports 9042, 9160 and forward to the listeners.

I can successfully connect to the ELB and access the data without any issue, but in this thread[1] it tells it might not work as we expects but its not very clear why.

Is there a better way to solve this issue (I am considering the securing Cassandra Cluster as an option too).


Regards
Lahiru

Olivier Michallat

unread,
May 13, 2016, 6:07:52 PM5/13/16
to java-dri...@lists.datastax.com
Hi,

The driver needs a separate IP address for each node that it connects to. If you hide your nodes behind an ELB, the driver will see them as a single host, so that defeats its built-in load balancing and failover logic.

So if you want to connect directly, you need a public IP for each node.
You can declare it as the broadcast_rpc_address in cassandra.yaml,  but that means all applications will have to go through these addresses.
If you only have one "external" application, and other "internal" applications that should use the private addresses, an alternate solution is to use an AddressTranslator in the external app. The Address resolution section in our docs has more information about that.

As an alternative, you could have an extra layer between your external application and your database, such as a REST service.

--

Olivier Michallat

Driver & tools engineer, DataStax


--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.

Message has been deleted

Anibal Bicho DBZ Capotorto

unread,
Dec 15, 2016, 8:27:21 AM12/15/16
to DataStax Java Driver for Apache Cassandra User Mailing List
on a slightly different approach to this question.

if I have all my cassandra nodes behind an ELB, but the clients also have the possibility of connecting to the cassandra nodes directly (same subnet, etc), is the ELB a viable option to avoid configuring each cassandra hostname/ip in the clients? 

I was told the initial connection is to figure out which node has the data I'm looking for and then there is a direct connection to that node afterwards , in my scenario, this connection will bypass the elb

Thanks
Bicho

Anibal Bicho DBZ Capotorto

unread,
Dec 15, 2016, 8:28:51 AM12/15/16
to DataStax Java Driver for Apache Cassandra User Mailing List
btw "no, that is not how it works" is as sufficient answer :D
Reply all
Reply to author
Forward
0 new messages