[英]Cassandra PHP Driver hangs
通过 cluster->connect() 连接到集群时,PHP 脚本挂起。
当我尝试使用 nodejs 驱动程序时:
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 );
我们得到以下 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
}
当我们使用 PHP 执行此操作时,它会挂起:
<?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() ) );
下面附上所需的文件。
index.php -> https://pastebin.com/iihpJfpW
流浪文件-> https://pastebin.com/BkPwynxy
cassandra.repo -> https://pastebin.com/LbraCY3f
index.js -> https://pastebin.com/TSPc0bLm
注意:
这不是 Vagrant 问题,因为在我们运行 CentOS 7.6 的舞台环境中也会出现同样的问题
环境:
CentOS 7.6
Cassandra 3.11.6 原生协议 v4
NodeJs 12 NodeJs Cassandra 驱动程序 4.5.0
PHP 7.2 PHP Cassandra 驱动程序(最新,通过 yum install -y php72-php-pecl-cassandra.x86_64 安装)
Vagrant 2.2.7 Oracle VirtualBox 版本 6.1.4 r136177 (Qt5.6.2)
查看您询问的日期和症状,我认为您遇到了这个错误。
尝试将cassandra-cpp-driver
升级到 v2.15.2 并查看它是否有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.