NodeJS Hbase节俭怪异 [英] NodeJS Hbase thrift weirdness

查看:100
本文介绍了NodeJS Hbase节俭怪异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个非常奇怪的情况。我一直在尝试使用thrift来获取nodeJS客户端,以便运行Hbase,除了获取任何返回数据外,我似乎大部分时间都取得了成功。我正在运行hbase.0.94.8(目前是稳定版本),并且它确实正在运行,我正在运行节俭0.9.0,它也被构建并运行。在他们两个都在运行的情况下,我可以用shell查询Hbase并进入节俭网页,但是当我运行下面的代码时,什么也没有发生:



<$ p $ HBase = require('./Hbase.js'),
HBaseTypes = require('./Hbase_types.js' );

var connection = thrift.createConnection('localhost',9090,{transport:thrift.TBufferedTransport,protocol:thrift.TBinaryProtocol});
$ b connection.on('connect',function(){
console.log('connected');
var client = thrift.createClient(HBase,connection);
client.getTableNames(function(err,data){
if(err)
console.log('有错误:',err);
else
console.log('hbase tables:',data);
});
});
$ b connection.on('error',function(err){
console.log('error',err);
});

我肯定会得到一个连接(或者至少会触发连接事件),但它就像是另一端没有任何东西。在你回答之前,Hbase master肯定在运行,节俭肯定在运行,9095上的网页和9090上的服务(由日志报告)。这些日志似乎反映出什么都没有发生(例如,thrift和hbase日志似乎不受请求的影响),但我确实获得了成功的连接。



有什么想法?

解决方案

我有问题的答案。给我吧,我只想说,我实际上认为我提出的问题很重要,因为答案很明显,但很微妙。也许早期的节俭版本是不同的,但在0.9.0框架传输默认情况下是不开启的,它需要在节点上。没有关于hbase,thrift和node的教程或解释提到了这一点,所以它应该在互联网上的某个地方。



Hbase的节俭服务器必须以帧传输开始(标志-f)为节点工作,如下所示:

  [hbase-dir] / bin / hbase-daemon。 sh start thrift -f 


I'm running into a very odd situation. I've been trying to get a nodeJS client, using thrift, for Hbase running, and I have seemingly had success most of the way except getting any return data. I'm running hbase.0.94.8 (currently the stable version), and it is definitely running, I'm running thrift 0.9.0, it is built and running as well. With both of them running I'm able to query Hbase with the shell and also get to the thrift webpage, but when I run the following code, nothing happens:

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);
});

I definitely get a connection (or, at least, the connection event fires), but it's like there's nothing on the other end. Before you answer, Hbase master is definitely running, thrift is definitely running, the webpage on 9095 and the service on 9090 (as reported by the logs). The logs seem to reflect that nothing is even happening (i.e. thrift and hbase logs seem unaffected by the request), but I am definitely getting a successful connection.

Any thoughts?

解决方案

I have the answer to the question.

Before I give it I just want to preface by saying that I actually think the question that I asked is important, because the answer was obvious and yet subtle. Maybe earlier versions of thrift are different, but on 0.9.0 framed transport is not on by default and it needs to be on for node. No tutorial or explanation of hbase, thrift, and node mentions this, so it deserves to be somewhere on the internet.

Hbase's thrift server must be started with frame transport on (flag "-f") for node to work, like so:

[hbase-dir]/bin/hbase-daemon.sh start thrift -f

这篇关于NodeJS Hbase节俭怪异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆