Take the 2-minute tour ×

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

  var client = thrift.createClient(HBase,connection);
        console.log('there was an error:',err);
        console.log('hbase tables:',data);


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?

share|improve this question
add comment

2 Answers

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

    hbase-daemon.sh start thrift -f

and I found connection setup needs a little change

    connection = thrift.createConnection('localhost', 9090, {
        transport: thrift.TFramedTransport,  //TBufferedTransport doesn't work!
        //protocol: thrift.TBinaryProtocol   //protocol seems not required
share|improve this answer
Thanks. What's funny is that is what the -f flag does (frames the transport, since, presumably, node is communicating via a persistent connection), so I knew that I just made the mistake of not editing my own code. I'll try contacting dailyjs to see if they'll let me edit it. –  Nathan Sweet Jan 17 at 22:28
Also, I would keep the protocol key in place, as it is informative. Granted that TBinaryProtocol is the default, but someone reading through the thrift documentation might not know that. –  Nathan Sweet Jan 17 at 22:39
add comment
up vote 0 down vote accepted

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
share|improve this answer
add comment

Your Answer


