Pushpendra
Pushpendra

Reputation: 55

How does Cassandra driver update contactPoints if all pods are restarted in Kubernetes without restarting the client application?

We have created a statefulset & headless service. There are 2 ways by which we can define peer ips in application:

  1. Use 'cassandra-headless-service-name' in contactPoints
  2. Fetch the peers ip from headless-service & externalize the peers ip and read these ips when initializing the connection. SO far so good. Above will work if one/some pods are restarted, not all. In this case, driver will updated the new ips automatically.

But, how this will work in case of complete outage ? If all pods are down & when they come back, if all pods ip are changed (IP can change in Kubernetes), how do application will connect to Cassandra?

Upvotes: 0

Views: 294

Answers (1)

Aaron
Aaron

Reputation: 57748

In a complete outage, you're right, the application will not have any valid endpoints for the cluster. Those will need to be refreshed (and the app restarted) before the app will connect to Cassandra.

We actually wrote a RESTful API that we can use query current, valid endpoints by cluster. That way, the app teams can find the current IPs for their cluster at any time. I recommend doing something similar.

Upvotes: 1

Related Questions