0

Below is my basic program

public static void main(String[] args) {
  Cluster cluster;
  Session session;

  cluster  = Cluster.builder().addContactPoint("192.168.20.131").withPort(9042).build();

  System.out.println("Connection Established");

  cluster.close();
}

Now i want to know that i have a 7 node cluster and i have cassandra instance running on all 7 nodes. Assuming that the above mentioned IP address is my entry point how does it actually works. Suppose some other user try to run a program on any other cassandra node out of 7 so which IP will be entered as Contact Point. Or do i have to add all the 7 nodes IP addresses comma separated in my main() method ..?

Carlo Bertuccini
  • 19,615
  • 3
  • 28
  • 39
AJm
  • 993
  • 2
  • 20
  • 39
  • possible duplicate of [Cassandra Java driver: how many contact points is reasonable?](http://stackoverflow.com/questions/26852413/cassandra-java-driver-how-many-contact-points-is-reasonable) – Carlo Bertuccini Feb 24 '15 at 09:01

1 Answers1

0

As it is described here,

The driver discovers the nodes that constitute a cluster by querying the contact points used in building the cluster object. After this it is up to the cluster's load balancing policy to keep track of node events (that is add, down, remove, or up) by its implementation of the Host.StateListener interface.

Roman Tumaykin
  • 1,921
  • 11
  • 11