doudai3012 2013-01-14 22:54
浏览 48
已采纳

cassandra-pdo错误选择复合键

I'm getting the error below in /var/log/apache2/error.log when selecting data using cassandra-pdo on PHP:

[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
Stack trace:
#0 /var/www/test_cassandra_pdo.php(13): PDOStatement->execute()
#1 {main}
  thrown in /var/www/test_cassandra_pdo.php on line 13

I'm using:

Below is my PHP code:

// 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);

Below is the data structure (created and listed with 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'};

The select using cqlsh:

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

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

I opened a issue on cassandra-pdo but without any return:

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

Anybody can help?

  • 写回答

1条回答 默认 最新

  • dougou6114 2013-02-20 06:24
    关注

    There is a fork of cassandra pdo. I started using it. But not sure if I will move completely to it. I will test how developers reacts to my issues reports. If it will not be actively maintained, I will move back to original pdo from apache and use cql2. Hope it will not happen, cql3 map type is so useful.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。