cassandra-pdo错误选择复合键

时间:2013-01-14 22:54:50

标签: php pdo cassandra cql3

在PHP上使用cassandra-pdo选择数据时,我在/var/log/apache2/error.log中收到以下错误:

[Mon Jan 14 23:37:47 2013] [error] [client 10.0.0.5] PHP Fatal error:  Uncaught exception 'PDOException' with message 'CQLSTATE[08006] [8] No more data to read.' in /var/www/test_cassandra_pdo.php:13\nStack trace:\n#0 /var/www/test_cassandra_pdo.php(13): PDOStatement->execute()\n#1 {main}\n  thrown in /var/www/test_cassandra_pdo.php on line 13

我正在使用:

以下是我的PHP代码:

// Connect to two hosts
$dsn = "cassandra:host=cassandra001,port=9160;host=cassandra002,port=9160;cqlversion=3.0.0";
$db = new PDO($dsn);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->exec("USE test");

$stmt = $db->prepare("SELECT page, local, key, vl FROM lalala;");
//$stmt->bindValue(':key', 'a');
$stmt->execute();

$result = $stmt->fetchAll();
var_dump($result);

以下是数据结构(使用cqlsh创建并列出):

Connected to test at cassandra001:9160.
[cqlsh 2.3.0 | Cassandra 1.2.0 | CQL spec 3.0.0 | Thrift protocol 19.35.0]
Use HELP for help.
cqlsh> use test;
cqlsh:test> describe table lalala;

CREATE TABLE lalala (
page text,
local text,
key text,
value text,
vl text,
PRIMARY KEY (page, local, key)
) WITH
bloom_filter_fp_chance=0.010000 AND
caching='KEYS_ONLY' AND
comment='' AND
dclocal_read_repair_chance=0.000000 AND
gc_grace_seconds=864000 AND
read_repair_chance=0.100000 AND
replicate_on_write='true' AND
compaction={'class': 'SizeTieredCompactionStrategy'} AND
compression={'sstable_compression': 'SnappyCompressor'};

使用cqlsh进行选择:

cqlsh:test> SELECT page, local, key, vl FROM lalala;

 page       | local | key   | vl
------------+-------+-------+----------------
 teste.html |    EN | title | Ola, bem vindo

我在cassandra-pdo上打开了一个问题,但没有任何回报:

http://code.google.com/a/apache-extras.org/p/cassandra-pdo/issues/detail?id=15

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

There is a fork的{p> cassandra pdo。我开始使用它。但不确定我是否会完全转向它。我将测试开发人员如何对我的问题报告做出反应。如果它不会被主动维护,我将从apache返回原始pdo并使用cql2。 希望它不会发生,cql3地图类型是如此有用。