I am trying to get some example php code for connecting to a cassandra cluster. The problem I am having is that I do not get any output from retriving the data from the node. I limited the problem to this piece of code.
$cluster = Cassandra::cluster()
->build();
Here is the rest of the code for reference.
<?php
$cluster = Cassandra::cluster() // connects to localhost by default
->build();
$keyspace = 'system';
$session = $cluster->connect($keyspace); // create session, optionally scoped to a keyspace
$statement = new Cassandra\SimpleStatement( // also supports prepared and batch statements
'SELECT keyspace_name, columnfamily_name FROM schema_columnfamilies'
);
$future = $session->executeAsync($statement); // fully asynchronous and easy parallel execution
$result = $future->get(); // wait for the result, with an optional timeout
foreach ($result as $row) { // results and rows implement Iterator, Countable and ArrayAccess
printf("The keyspace %s has a table called %s
", $row['keyspace_name'], $row['columnfamily_name']);
}
?>