????1?? ????thrift-0.9.1.exe??????thrift-0.9.1.tar.gz
????2??????thrift-0.9.1.exe????????thrift????hbase???????????
??????hbase??????
????hbase-0.96.0-srchbase-0.96.0hbase-thriftsrcmain esourcesorgapachehadoophbase hrift
???????HBase.Thrift???????????thrift-0.9.1.exe?????£?
??????cmd?????????л???thrift-0.9.1???£????????????????????thrift??????c#????????????gen-csharp???????
????thrift-0.9.1.exe -gen csharp HBase.Thrift
????3????vs2010???????????
????HBaseThriftAPI?????2????????????Thrift(????????????????????????-???????thrift-0.9.1libcsharpsrcThrift.sln)?????thrift-0.9.1??????????????????????????????
??????????????????IThrift?????????????????????????????????а?Thrift??????????ù?????
????????ithrift????????????hbase????thrift????????????TestClient.cs????????????(????????????IP?????????????м?4??????????????????滻???)??
using System;
using System.Collections.Generic;
using System.Threading;
using Thrift.Collections;
using Thrift.Protocol;
using Thrift.Transport;
using System.Text;
namespace Test
{
publicclassTestClient
{
publicstaticvoid Main(string[] args)
{
try
{
TTransport transport = new TSocket("192.168.0.101"?? 9090);//?????IP?????
TProtocol tProtocol = new TBinaryProtocol(transport);
var client = new Hbase.Client(tProtocol);
transport.Open();
List<TRowResult> reslut = client.getRow(Encoding.UTF8.GetBytes("test")??Encoding.UTF8.GetBytes("a")??null);//?????????????????м???
foreach (var key in reslut)
{
Console.WriteLine(Encoding.UTF8.GetString(key.Row));
foreach (var k in key.Columns)
{
Console.Write(Encoding.UTF8.GetString(k.Key) +" ");
Console.WriteLine(Encoding.UTF8.GetString(k.Value.Value));
}
}
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine(e.StackTrace);
}
}
}
}
????12????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????