Contact Point Disconnect Problem

25 views
Skip to first unread message

Marco

unread,
Apr 15, 2019, 5:00:06 AM4/15/19
to DataStax PHP Driver for Apache Cassandra User Mailing List
We have a cassandra cluster setup in Azure with 2 nodes, both nodes are in a private network and both nodes have a public ip assigned to them. We talk against the cluster with our api written in php. In the api we connect to the cluster with the datastax php driver via the public ip's:

$cluster = Cassandra::cluster()
->withContactPoints('xxx.xxx.xxx.xxx', 'xxx.xxx.xxx.xxx')
->withPort(9042)
->build();
$session = $cluster->connect();


All keyspaces are on Replication Factor 2, so that both nodes have all the data. Both the nodes are also seeds.

The problem is that if we turn off 1 of the nodes, the datastax driver somehow doesn't recognize that the contact point is down and will still try to connect to the disconnected contact point, instead of trying the other one.

The question is:
How can we ensure that if 1 of the contact points goes down, the php driver will use the other contact point?

Fero

unread,
Apr 15, 2019, 1:49:07 PM4/15/19
to DataStax PHP Driver for Apache Cassandra User Mailing List
Marco,

the datastax driver somehow doesn't recognize that the contact point is down and will still try to connect to the disconnected contact point, instead of trying the other one

By default the driver will connect to all of the nodes in the cluster based on the configured load balancing policy. The driver will detect when a node goes down and will attempt to reconnect to that node based on the interval configured using the Cluster/Builder; see the driver logs for more information. When a node is decommissioned (e.g. removed) from the cluster the driver will detect the removal of a node and no longer attempt to reconnect to that node.

How can we ensure that if 1 of the contact points goes down, the php driver will use the other contact point?

This is the function of the driver; it will always keep a connection to the cluster unless every node in the cluster is no longer available. To check to see how many connections the driver has established in the cluster you can check the total_connections in Cassandra\Session::metrics.

~Fero

Marco

unread,
Apr 16, 2019, 9:48:53 AM4/16/19
to DataStax PHP Driver for Apache Cassandra User Mailing List
Hello Fero,

Thank you for the reply, I have re-tested it with logging on and it seems to work. What I did wrong was that I disabled 1 node, restarted it, and stopped the other node with very little time in between (apparently too quick).

Greetings,
Marco



Op maandag 15 april 2019 19:49:07 UTC+2 schreef Fero:
Reply all
Reply to author
Forward
0 new messages