I am currently involved in creating an API that uses a Cassandra cluster with 3 nodes for storing data. I was developing it on my local machine using PHP 5.6.17, Cassandra 2.2.3 and the Datastax PHP Driver 1.1.0 and everything went fine.
However, we decided to move to a remote Cassandra cluster (3.4 with native protocol 4) and I cannot access it through PHP as I get the following error: An error occured: 16777226 - No hosts available for the control connection.
The funny thing is that using the remote cluster's ip and using the DevCenter, I managed to connect to that cluster, create a new keyspace (SimpleStrategy, RF:2), create a new table and add one row of data.
The error producing PHP code is the following:
$cluster = \Cassandra::cluster()
->withContactPoints('x.x.x.x')
->build();
$keyspace = 'foo';
$session = $cluster->connect($keyspace);
The last line is the one producing the error. However, if I try to connect to the local cassandra cluster using $cluster = \Cassandra::cluster()->build();
then it works like a charm.
Does anybody have any idea why this is happening?