Reputation: 21
When connecting to the cluster via cluster->connect() the PHP script hangs.
While I try this with the nodejs driver :
const cassandra = require('cassandra-driver');
const client = new cassandra.Client({
contactPoints: ['127.0.0.1'],
localDataCenter: 'datacenter1',
keyspace: 'test'
});
const query = 'SELECT * FROM mytable';
client.execute(query).then(console.log).catch( console.log );
We get the following output :
ResultSet {
info: {
queriedHost: '127.0.0.1:9042',
triedHosts: { '127.0.0.1:9042': null },
speculativeExecutions: 0,
achievedConsistency: 10,
traceId: undefined,
warnings: undefined,
customPayload: undefined,
isSchemaInAgreement: true
},
rows: [ Row { id: 'test' } ],
rowLength: 1,
columns: [ { name: 'id', type: [Object] } ],
pageState: null,
nextPage: undefined,
nextPageAsync: undefined
}
When we do this with PHP it hangs :
<?php
$cluster = \Cassandra::cluster()
->withContactPoints( '127.0.0.1' )
->withPort( 9042 )
->build();
// This will happen immediately
// var_dump( 'Built!' );exit;
$session = $cluster->connect( 'test' );
// This hangs. It never dumps 'Connected!'.
var_dump( 'Connected!' );exit;
var_dump( $session->execute( new \Cassandra\SimpleStatement( 'select * from mytable' ), array() ) );
Below are attached the files needed.
index.php -> https://pastebin.com/iihpJfpW
Vagrantfile -> https://pastebin.com/BkPwynxy
cassandra.repo -> https://pastebin.com/LbraCY3f
index.js -> https://pastebin.com/TSPc0bLm
NOTE :
This is not a Vagrant issue, as the same problem occurs in our Stage environment running CentOS 7.6
Environment:
CentOS 7.6
Cassandra 3.11.6 Native Protocol v4
NodeJs 12 NodeJs Cassandra Driver 4.5.0
PHP 7.2 PHP Cassandra Driver ( latest, installed via yum install -y php72-php-pecl-cassandra.x86_64 from remi )
Vagrant 2.2.7 Oracle VirtualBox Version 6.1.4 r136177 (Qt5.6.2)
Upvotes: 2
Views: 274
Reputation: 71
Looking at the date you asked and the symptoms, I think you are hitting this bug.
Try upgrading the cassandra-cpp-driver
to the v2.15.2 and see if it works.
Upvotes: 1