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:
Just read through your full article http://dailyjs.com/2013/07/04/hbase/ and tried it on OSX 10.9.1 (Java 1.6.0_65), with Hadoop (1.2.1) & HBase (0.94.15) installed via Homebrew.
I started thrift server with the -f flag
and I found connection setup needs a little change