2012-02-01 22 views
0

开始卡桑德拉服务器和客户端卡桑德拉后,我创建“Keyspace1”,列族“标准1”成功。使用Net-Cassandra-Easy-0.15,我执行了一个Perl程序并得到结果:净卡桑德拉易于设置密钥空间

$VAR1=bless({ 
    'why'=>'You have not set a keyspace for this session' 
    },'Net::GenCassandra::InvalidrequestException'); 

你有什么提示来解决这个问题吗?

我的Perl程序如下:

#!/usr/bin/perl 

use lib './lib'; 
use strict; 
use warnings; 
use Net::Cassandra::Easy; 
use Data::Dumper; 

eval { 
    my $client = Net::Cassandra::Easy->new(
    server => 'localhost', 
    port => 9160, 
    keyspace => 'Keyspace1'); 
    $client->connect(); 
    my $key = 'rt'; 
    # get 
    my $result = $client->get([$key], 
     family => 'Standard1', 
     byname => [qw/name age site/]); 
    print Dumper($result); 
    # insert 
    $client->mutate([$key], 
     family => 'Standard1', 
     insertions => { 'site' => 'rest-term' }); 
    # get 
    $result = $client->get([$key], 
     family => 'Standard1', 
     byname => [qw/name age site/]); 
    print Dumper($result); 
}; 
die Dumper([email protected]) if [email protected]; 
+0

欲了解更多信息:这个问题发生之前,我得到“无法读取4个字节......”的错误。我取代“BufferedTransport”由“FramedTransport”的Easy.pm模块中,然后“无法读取4个字节...”错误是固定的。但是这个“你没有为这个会话设置密钥空间”的错误,我还不知道有什么方法可以解决。 – Aloha 2012-02-01 07:36:34

回答

1

是看到这个CPAN评论:

“这可能是一个很好的模块,如果进行了更新,但这个版本太旧,是有用的它显示该模块不会

什么卡桑德拉版本您使用的卡珊德拉的任何版本5.x的上述“工作?

有这个包一个test.pl,尝试运行它。

我的猜测是,你Keyspace1是不是在你的卡桑德拉安装有效的密钥空间。你能用一些命令行工具运行这个查询吗?

+0

我的问题发生在Cassandra 1.0.7(最新的版本)。我还不知道原因。我更改为0.7.10版本,并使用Thrift0.7.0和gen-perl(不再使用Easy),现在运行良好。谢谢! – Aloha 2012-02-08 06:45:55