【发布时间】:2012-04-16 09:17:50
【问题描述】:
我使用 Thrift 0.8 为 Cassandra 1.0.8 生成了客户端。然后我尝试了以下示例。 transport.open() 通过,但我无法描述_keyspace 或 set_keyspace
TTransport transport = new TBufferedTransport(new TSocket("localhost", 9160));
TProtocol protocol = new TBinaryProtocol(transport);
Cassandra.Client client = new Cassandra.Client(protocol);
Console.WriteLine("Opening connection");
try
{
transport.Open();
}
catch (Exception e)
{
Console.WriteLine("error connecting...");
return;
}
KsDef def = client.describe_keyspace("nm_example"); // error here
client.set_keyspace("nm_example");// error here
这是我得到的例外
An unhandled exception of type 'Thrift.Transport.TTransportException' occurred in Thrift.dll
Additional information: Cannot read, Remote side has closed
我可以使用 CLI 连接到密钥空间。我做错了什么吗?客户端是否仅适用于某些版本?有没有人使用 Thrift 和 C# 成功连接到最新的 Cassandra?
【问题讨论】:
-
你真的应该使用更高级别的库而不是直接使用thrift。我建议你看看code.google.com/p/cassandra-sharp
标签: c# .net nosql cassandra thrift