簡體   English   中英

Cassandra PHP 驅動程序掛起

[英]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

  1. 制作新文件夾“cassandraTest”
  2. 將 Vagrantfile 放入文件夾中
  3. 在“cassandraTest”中創建名為“provision”的新目錄
  4. 把 cassandra.repo 放在那里
  5. vagrant向上

注意

這不是 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM