2012-02-01 64 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