Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started



szbhojan_49886 avatar image
szbhojan_49886 asked Erick Ramirez edited

How do I configure Cassandra to use a virtual IP?

How to Configure Virtual IP in cassandra.yaml file? If there is no VIP, then how client/user will connect to cluster with 4 nodes?

cassandraload balancing
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered nethisandeep commented

@szbhojan_49886 We do not recommend the use of a virtual IP or a hardware/software load-balancer for Cassandra because the clients/apps use the built-in load-balancing policy on the Cassandra drivers.

For example if you are using the Java driver, by default the driver uses a load-balancing policy that routes queries to the local data centre with a token-aware policy that prefers to route requests to replicas (nodes) that own the data being queried.

The driver knows about the nodes in the cluster because it connects to contact points (whitelist of node IP addresses) to establish a control connection at startup time. The driver uses the control connection to perform tasks that include querying the system tables to learn about the cluster topology. Using the control connection, the driver also listens for changes to the cluster automatically so it is aware of things like node additions, node outages, new data centres and decommissions in real time.

For this reason, it is not advisable to use external load balancers or DNS virtual IPs since it affects the ability of the drivers to operate in the optimum way.

If you're interested, check out the Java driver documentation on Control connection and Load balancing. Cheers!

4 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Thanks Erick, Stilli have some doubts to clarify, For an example, if a cluster is having 12 nodes, how many seed nodes can be defined? and also, how to configure client to connect the cluster ? Is it necessary to provide client with all the 12 node's IP address to communicate with client ? Actually how client/user will communicate with the cluster if there is no VIP ? Please Clarify .

0 Likes 0 ·

No. You just need to provide several IPs to connect - usually it's recommended to use seed nodes. After driver connects to first IP that responds, it reads information about cluster topology, and gets IPs of the all nodes in the cluster, and can work with them

0 Likes 0 · is correct. As I've stated in my answer, the driver uses the control connection to query the system tables to learn about the cluster topology. Please see the documents I have provided in my answer since they explain it in detail. Cheers!

0 Likes 0 ·

@Erick Ramirez

Is it required to maintain read permissions on system keyspace for the application user? In general we don't grant read permissions on system keyspace to application users. In this case how would an application user can learn about topology changes?

0 Likes 0 ·