Skip to content

Instantly share code, notes, and snippets.

@staaldraad
Created March 10, 2015 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save staaldraad/9e59112519d7fa9b8397 to your computer and use it in GitHub Desktop.
Save staaldraad/9e59112519d7fa9b8397 to your computer and use it in GitHub Desktop.
dump data from HBase database
var thrift = require('thrift');
var util = require('util')
var HBase = require('./gen-nodejs/Hbase');
var HBaseTypes = require('./gen-nodejs/Hbase_types');
var port = 9090
//var connection = thrift.createConnection(process.argv[2], port, { transport: thrift.TFramedTransport,protocol:thrift.TBinaryProtocol });
var connection = thrift.createConnection(process.argv[2], port, { transport: thrift.TBufferedTransport, protocol:thrift.TBinaryProtocol });
connection.on('connect', function () {
console.log('[*] Connected: '+process.argv[2]);
var client = thrift.createClient(HBase, connection);
client.getTableNames(function(err,data) {
if (err) {
console.log('gettablenames error:', err);
} else {
console.log('hbase tables:');
data.forEach(function(table){
console.log('[*] ',table.toString())
});
}
connection.end();
});
});
connection.on('error',function(err){
console.error("[x] Ay-ya-ya: "+err)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment