Nat*_*eet 3 hbase thrift node.js
我遇到了一个非常奇怪的情况.我一直在尝试使用thrift来运行一个nodeJS客户端来运行Hbase,除了获取任何返回数据之外,我看起来大部分都是成功的.我正在运行hbase.0.94.8(目前是稳定版本),它肯定在运行,我正在运行节俭0.9.0,它也已经构建并运行.在它们都运行的情况下,我可以使用shell查询Hbase并访问thrift网页,但是当我运行以下代码时,没有任何反应:
var thrift = require('thrift'),
HBase = require('./Hbase.js'),
HBaseTypes = require('./Hbase_types.js');
var connection = thrift.createConnection('localhost',9090,{ transport: thrift.TBufferedTransport,protocol:thrift.TBinaryProtocol });
connection.on('connect',function(){
console.log('connected');
var client = thrift.createClient(HBase,connection);
client.getTableNames(function(err,data){
if(err)
console.log('there was an error:',err);
else
console.log('hbase tables:',data);
});
});
connection.on('error',function(err){
console.log('error',err);
});
Run Code Online (Sandbox Code Playgroud)
我肯定得到一个连接(或者,至少,连接事件触发),但它就像在另一端没有任何东西.在您回答之前,Hbase master肯定在运行,thrift肯定在运行,9095上的网页和9090上的服务(由日志报告).日志似乎反映出甚至没有发生任何事情(即thrift和hbase日志似乎不受请求的影响),但我肯定会获得成功的连接.
有什么想法吗?
小智 5
只需阅读完整的文章http://dailyjs.com/2013/07/04/hbase/并在OSX 10.9.1(Java 1.6.0_65)上尝试使用Hadoop(1.2.1)和HBase(0.94.15) )通过Homebrew安装.
我用-f标志启动了thrift服务器
hbase-daemon.sh start thrift -f
Run Code Online (Sandbox Code Playgroud)
我发现连接设置需要一点点改变
connection = thrift.createConnection('localhost', 9090, {
transport: thrift.TFramedTransport, //TBufferedTransport doesn't work!
//protocol: thrift.TBinaryProtocol //protocol seems not required
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1436 次 |
| 最近记录: |