Giter VIP home page Giter VIP logo

node-hbase-client's Introduction

hbase-client

NPM version build status Test coverage Gittip David deps node version npm download

logo

Asynchronous HBase client for Node.js, pure JavaScript implementation.

Support HBase Server Versions

  • 0.94.x
    • 0.94.0
    • 0.94.16
  • 0.96.x
  • 0.98.x

If you're use HBase >= 0.96.x, please use hbase-rpc-client which CoffeeScript HBase Implementation with protobuf.

Install

$ npm install hbase-client --save

Run Unit Test

Start local hbase server

$ ./start-local-hbase.sh

If everything go fine, run tests

$ make test

Stop hbase server

$ ./stop-local-hbase.sh

Get Started with CRUD

  • Create a hbase client through zookeeper:
var HBase = require('hbase-client');

var client = HBase.create({
  zookeeperHosts: [
    '127.0.0.1:2181' // only local zookeeper
  ],
  zookeeperRoot: '/hbase-0.94.16',
});
  • Put a data row to hbase:
client.putRow('someTableName', 'rowkey1', {'f1:name': 'foo name', 'f1:age': '18'}, function (err) {
  console.log(err);
});
  • Get the row we put:
client.getRow('someTableName', 'rowkey1', ['f1:name', 'f1:age'], function (err, row) {
  console.log(row);
});
  • Delete the row we put:
client.deleteRow('someTableName', 'rowkey1', function (err) {
  console.log(err);
});

Usage

get(table, get, callback): Get a row from a table

var HBase = require('hbase-client');

var client = HBase.create({
  zookeeperHosts: [
    '127.0.0.1:2181', '127.0.0.1:2182',
  ],
  zookeeperRoot: '/hbase-0.94',
});

// Get `f1:name, f2:age` from `user` table.
var param = new HBase.Get('foo');
param.addColumn('f1', 'name');
param.addColumn('f1', 'age');

client.get('user', param, function (err, result) {
  console.log(err);
  var kvs = result.raw();
  for (var i = 0; i < kvs.length; i++) {
    var kv = kvs[i];
    console.log('key: `%s`, value: `%s`', kv.toString(), kv.getValue().toString());
  }
});

getRow(table, rowkey, columns, callback)

client.getRow(table, row, ['f:name', 'f:age'], function (err, row) {
  row.should.have.keys('f:name', 'f:age');
});

// return all columns, like `select *`
client.getRow(table, row, function (err, row) {
  row.should.have.keys('f:name', 'f:age', 'f:gender');
});

client.getRow(table, row, '*', function (err, row) {
  row.should.have.keys('f:name', 'f:age', 'f:gender');
});

put(table, put, callback): Put a row to table

var put = new HBase.Put('foo');
put.add('f1', 'name', 'foo');
put.add('f1', 'age', '18');
client.put('user', put, function (err) {
  console.log(err);
});

putRow(table, rowKey, data, callback)

client.putRow(table, rowKey, {'f1:name': 'foo name', 'f1:age': '18'}, function (err) {
  should.not.exists(err);
  client.getRow(table, rowKey, function (err, row) {
    should.not.exist(err);
    should.exist(row);
    // {
    //   'cf1:age': <Buffer 31 38>,
    //   'cf1:name': <Buffer 66 6f 6f 20 6e 61 6d 65>
    // }
    row['cf1:name'].toString().should.equal('foo name');
    row['cf1:age'].toString().should.equal('18');
    done();
  });
});

delete(tableName, del, callback)

var del = new Delete(rowkey);
del.deleteColumns('f', 'name-t');
client.delete(table, del, function (err, result) {
  //TODO:...
});
var del = new Delete(rowkey);
del.deleteFamily('f');
client.delete(table, del, function (err, result) {
  //TODO:...
});

deleteRow(tableName, rowkey, callback)

var tableName = 'user_search';
var rowkey = 'rowkeyyyyyy';
client.deleteRow(tableName, rowkey, function (err) {
  //TODO:...
});

mget(tableName, rows, columns, callback)

var rows = ['row1', 'row2'];
var columns = ['f:col1', 'f:col2'];
client.mget(tableName, rows, columns, function (err, results){
  //TODO:...
});

mput(tableName, rows, callback)

var rows = [{row: 'rowkey1', 'f:col1': 'col_value'}, {row: 'rowkey2', 'f:col1': 'col_value'}];
client.mput(tableName, rows, function (err, results) {
  //TODO:...
});

mdelete(tableName, rowkeys, callback)

var rowKeys = ['rowkey1', 'rowkey2'];
client.mdelete(tableName, rowKeys, function (err, results) {
  //TODO:...
});

Atomic Operations

HBase 0.94 provides two checkAnd* atomic operations.

checkAndPut(tableName, family, qualifier, value, put, callback)

Atomically checks if a row/family/qualifier value matches the expected value.

  • If it does, it adds the put.
  • If the passed value is null, the check is for the lack of column (ie: non-existance)

eg.

var put = new Put('rowKey');
put.add('f:col1', 'value');

client.checkAndPut(tableName, 'rowKey', 'f', 'col1', 'val1', put, function (err, hasPut) {
  if (err) {
    // Do something
  }

  console.log(hasPut); // true or false, indicates if check passed and put
});

Refs: https://hbase.apache.org/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#checkAndPut(byte[],%20byte[],%20byte[],%20byte[],%20org.apache.hadoop.hbase.client.Put)

checkAndDelete(tableName, family, qualifier, value, deleter, callback)

Atomically checks if a row/family/qualifier value matches the expected value.

  • If it does, it adds the delete.
  • If the passed value is null, the check is for the lack of column (ie: non-existance)

eg.

var deleter = new Delete('rowKey');
deleter.deleteColumns('f', 'col1');

client.checkAndDelete(tableName, 'rowKey', 'f', 'col1', null, deleter, function (err, hasDeleted) {
  if (err) {
    // Do something
  }

  console.log(hasPut); // true or false, indicates if check passed and deleted
});

Refs: https://hbase.apache.org/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#checkAndDelete(byte%5B%5D,%20byte%5B%5D,%20byte%5B%5D,%20byte%5B%5D,%20org.apache.hadoop.hbase.client.Delete)

Scan

Scan table and return row key only

Java code:

FilterList filterList = new FilterList({operator: FilterList.Operator.MUST_PASS_ALL});
filterList.addFilter(new FirstKeyOnlyFilter());
filterList.addFilter(new KeyOnlyFilter());
Scan scan = new Scan(Bytes.toBytes("scanner-row0"));
scan.setFilter(filterList);

Nodejs code:

var filters = require('hbase-client').filters;

var filterList = new filters.FilterList({operator: filters.FilterList.Operator.MUST_PASS_ALL});
filterList.addFilter(new filters.FirstKeyOnlyFilter());
filterList.addFilter(new filters.KeyOnlyFilter());
var scan = new Scan('scanner-row0');
scan.setFilter(filterList);

client.getScanner('user', scan, function (err, scanner) {\
  var index = 0;
  var next = function (numberOfRows) {
    scanner.next(numberOfRows, function (err, rows) {
      // console.log(rows)
      should.not.exists(err);
      if (rows.length === 0) {
        index.should.equal(5);
        return scanner.close(done);
      }

      rows.should.length(1);

      var closed = false;
      rows.forEach(function (row) {
        var kvs = row.raw();
        var r = {};
        for (var i = 0; i < kvs.length; i++) {
          var kv = kvs[i];
          kv.getRow().toString().should.equal('scanner-row' + index++);
          kv.toString().should.include('/vlen=0/');
          console.log(kv.getRow().toString(), kv.toString())
        }
      });

      if (closed) {
        return scanner.close(done);
      }

      next(numberOfRows);
    });
  };

  next(1);
});

Scan table and return row filtered by single column value

Java code:

byte [] family = Bytes.toBytes("cf1");
byte [] qualifier = Bytes.toBytes("qualifier2");
FilterList filterList = new FilterList({operator: FilterList.Operator.MUST_PASS_ALL});
filterList.addFilter(new SingleColumnValueFilter(family, qualifier, CompareOp.LESS_OR_EQUAL, Bytes.toBytes("scanner-row0 cf1:qualifier2")));
filterList.addFilter(new SingleColumnValueFilter(family, qualifier, CompareOp.GREATER_OR_EQUAL, new BinaryPrefixComparator(Bytes.toBytes("scanner-"))));
filterList.addFilter(new SingleColumnValueFilter(family, qualifier, CompareOp.NOT_EQUAL, new BitComparator(Bytes.toBytes("0"), BitComparator.BitwiseOp.XOR)));
filterList.addFilter(new SingleColumnValueFilter(family, qualifier, CompareOp.NOT_EQUAL, new NullComparator()));
filterList.addFilter(new SingleColumnValueFilter(family, qualifier, CompareOp.EQUAL, new RegexStringComparator("scanner-*"))));
filterList.addFilter(new SingleColumnValueFilter(family, qualifier, CompareOp.EQUAL, new SubstringComparator("cf1:qualifier2"))));
Scan scan = new Scan(Bytes.toBytes("scanner-row0"));
scan.setFilter(filterList);

Nodejs code:

var filterList = new filters.FilterList({operator: filters.FilterList.Operator.MUST_PASS_ALL});
var family = 'cf1';
var qualifier = 'qualifier2';
filterList.addFilter(new filters.SingleColumnValueFilter(family, qualifier, 'LESS_OR_EQUAL', 'scanner-row0 cf1:qualifier2'));
filterList.addFilter(new filters.SingleColumnValueFilter(family, qualifier, 'GREATER_OR_EQUAL', new filters.BinaryPrefixComparator('scanner-')));
filterList.addFilter(new filters.SingleColumnValueFilter(family, qualifier, 'NOT_EQUAL', new filters.BitComparator('0', filters.BitComparator.BitwiseOp.XOR)));
filterList.addFilter(new filters.SingleColumnValueFilter(family, qualifier, 'NOT_EQUAL', new filters.NullComparator()));
filterList.addFilter(new filters.SingleColumnValueFilter(family, qualifier, 'EQUAL', new filters.RegexStringComparator('scanner-*')));
filterList.addFilter(new filters.SingleColumnValueFilter(family, qualifier, 'EQUAL', new filters.SubstringComparator('cf1:qualifier2')));
var scan = new Scan('scanner-row0');
scan.setFilter(filterList);

client.getScanner('user', scan, function (err, scanner) {\
  //TODO:...
});

TODO

  • support put
  • benchmark
  • more stable
  • support delete
  • multi actions
    • multi get
    • multi put
    • multi delete
  • fail retry
  • filters
    • FilterList
    • FirstKeyOnlyFilter
    • KeyOnlyFilter
    • SingleColumnValueFilter

Benchmarks

@see docs/benchmark.md

Authors

Thanks for @haosdent support the test hbase clusters environment and debug helps.

$ git summary

 project  : node-hbase-client
 repo age : 1 year, 7 months
 active   : 70 days
 commits  : 195
 files    : 297
 authors  :
   155	fengmk2                 79.5%
    20	tangyao                 10.3%
    15	Martin Cizek            7.7%
     1	coolme200               0.5%
     1	Alsotang                0.5%
     1	不四                  0.5%
     1	Lukas Benes             0.5%
     1	Vaclav Loffelmann       0.5%

License

(The MIT License)

Copyright (c) 2013 - 2014 Alibaba Group Holding Limited

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

node-hbase-client's People

Contributors

alsotang avatar coolme200 avatar dead-horse avatar falsecz avatar fengmk2 avatar gxcsoccer avatar hase1031 avatar misterdai avatar tzolkincz avatar wision avatar xadillax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-hbase-client's Issues

Update tests

  • make tests easier to modify via config (hostnames etc..)
  • allow dash in the hostname check
  • fix missing Result in connection.test.js

Mput errors

See output of 100-row mput here:
http://sprunge.us/QdYg

writes.push({ row: 'rowkey', 'cf:c': 'value' });
...
hbase.mput('table', _.first(writes, 100), function (error, result) {
if (error) return log.error(error);
log.info('RESULT', result);
});

The mput appears to insert the records correctly, but I get flooded with these errors, and the result object is full of nulls.

How to get row for a given timestamp

Hi,

I am curious how to get a row for a given timestamp. I was only able to fetch a row for ts=0 which gives me the newest version of the row. I probably missed the API where to set the timestamp. Can anyone help me with this?

Thanks in advance.

zookeeper error: Xid out of order. Got xid: 2 with error code: 0, expected xid: 1.

/home/suqian.yf/node-hbase-client/node_modules/zookeeper-watcher/node_modules/node-zookeeper-client/lib/ConnectionManager.js:489
                throw new Error(
                      ^
Error: Xid out of order. Got xid: 2 with error code: 0, expected xid: 1.
    at ConnectionManager.onSocketData (/home/suqian.yf/node-hbase-client/node_modules/zookeeper-watcher/node_modules/node-zookeeper-client/lib/ConnectionManager.js:489:23)
    at ConnectionManager.onSocketData (/home/suqian.yf/node-hbase-client/node_modules/zookeeper-watcher/node_modules/node-zookeeper-client/lib/ConnectionManager.js:572:14)
    at Socket.EventEmitter.emit (events.js:96:17)
    at TCP.onread (net.js:397:14)

warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at EventEmitter.addListener (events.js:175:15)
    at EventEmitter.once (events.js:196:8)
    at registerWatcher (/home/admin/datapi/target/datapi/node_modules/tcifapi/node_modules/hbase-client/node_modules/zookeeper-watcher/node_modules/node-zookeeper-client/lib/WatcherManager.js:31:24)
    at WatcherManager.registerDataWatcher (/home/admin/datapi/target/datapi/node_modules/tcifapi/node_modules/hbase-client/node_modules/zookeeper-watcher/node_modules/node-zookeeper-client/lib/WatcherManager.js:49:5)
    at ConnectionManager.registerDataWatcher (/home/admin/datapi/target/datapi/node_modules/tcifapi/node_modules/hbase-client/node_modules/zookeeper-watcher/node_modules/node-zookeeper-client/lib/ConnectionManager.js:173:25)
    at Object.Client.getData [as callback] (/home/admin/datapi/target/datapi/node_modules/tcifapi/node_modules/hbase-client/node_modules/zookeeper-watcher/node_modules/node-zookeeper-client/index.js:579:44)
    at ConnectionManager.onSocketData (/home/admin/datapi/target/datapi/node_modules/tcifapi/node_modules/hbase-client/node_modules/zookeeper-watcher/node_modules/node-zookeeper-client/lib/ConnectionManager.js:562:35)
    at ConnectionManager.onSocketData (/home/admin/datapi/target/datapi/node_modules/tcifapi/node_modules/hbase-client/node_modules/zookeeper-watcher/node_modules/node-zookeeper-client/lib/ConnectionManager.js:580:14)
    at ConnectionManager.onSocketData (/home/admin/datapi/target/datapi/node_modules/tcifapi/node_modules/hbase-client/node_modules/zookeeper-watcher/node_modules/node-zookeeper-client/lib/ConnectionManager.js:580:14)
    at ConnectionManager.onSocketData (/home/admin/datapi/target/datapi/node_modules/tcifapi/node_modules/hbase-client/node_modules/zookeeper-watcher/node_modules/node-zookeeper-client/lib/ConnectionManager.js:580:14)
    at ConnectionManager.onSocketData (/home/admin/datapi/target/datapi/node_modules/tcifapi/node_modules/hbase-client/node_modules/zookeeper-watcher/node_modules/node-zookeeper-client/lib/ConnectionManager.js:580:14)

Error: read Unknown system errno 50

events.js:71
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: read Unknown system errno 50
    at errnoException (net.js:770:11)
    at TCP.onread (net.js:425:21)

ConnectionClosedException on newer nodejs

Node 0.10.x emits error instead of close on the socket, which results in calling handleError instead of handleClose and some connection tests fail because of that.

support hbase 0.94.16

http://10.232.98.62:40130/master-status
<property>
    <name>hbase.zookeeper.property.clientPort</name>
    <value>40060</value>
  </property>
<property>
    <name>hbase.zookeeper.quorum</name>
    <value>10.232.98.53,10.232.98.54,10.232.98.55</value>
  </property>
  <property>
    <name>zookeeper.znode.parent</name>
    <value>/hbase-0.94.16</value>
  </property> 

版本是0.94.16,社区最新的stable版本

10.232.98.52 dw52.kgb.sqa.cm4
10.232.98.53 dw53.kgb.sqa.cm4
10.232.98.54 dw54.kgb.sqa.cm4
10.232.98.55 dw55.kgb.sqa.cm4
10.232.98.62 dw62.kgb.sqa.cm4

Connection `error` event handle

events.js:71
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: read Unknown system errno 50
    at errnoException (net.js:770:11)
    at TCP.onread (net.js:425:21)

hostname lookup error

> var dns = require('dns')
undefined
> dns.lookup('xxxx.cm6', console.log.bind(console));
{ oncomplete: [Function: onanswer] }
> null '10.1.1.1' 4
> dns.resolve('xxxx.cm6', console.log.bind(console));
{ oncomplete: [Function: onanswer] }
> { [Error: queryA ENOTFOUND] code: 'ENOTFOUND', errno: 'ENOTFOUND', syscall: 'queryA' }

Support `delete`

/**
 * Deletes all the KeyValues that match those found in the Delete object,
 * if their ts <= to the Delete. In case of a delete with a specific ts it
 * only deletes that specific KeyValue.
 * @param regionName region name
 * @param delete delete object
 * @throws IOException e
 */
public void delete(final byte[] regionName, final Delete delete) throws IOException;

Error:connect ECONNREFUSED not ConnectionConnectTimeoutException

Connection(dw58.kgb.sqa.cm4:60020)#474 socket destroy().
9 'ConnectionConnectTimeoutException'
Connection(dw58.kgb.sqa.cm4:60020)#479: clenaup 0 calls, send "Error:connect ECONNREFUSED" response.
Connection(dw58.kgb.sqa.cm4:60020)#479 closed with no error.
Connection(dw58.kgb.sqa.cm4:60020)#479: clenaup 0 calls, send "ConnectionClosedException:Connection(dw58.kgb.sqa.cm4:60020)#479 closed with no error." response.
Connection(dw58.kgb.sqa.cm4:60020)#475 socket destroy().
10 'ConnectionConnectTimeoutException'
Connection(dw58.kgb.sqa.cm4:60020)#480: clenaup 0 calls, send "Error:connect ECONNREFUSED" response.
Connection(dw58.kgb.sqa.cm4:60020)#480 closed with no error.
Connection(dw58.kgb.sqa.cm4:60020)#480: clenaup 0 calls, send "ConnectionClosedException:Connection(dw58.kgb.sqa.cm4:60020)#480 closed with no error." response.
Connection(dw58.kgb.sqa.cm4:60020)#476 socket destroy().

Connection reconnect

When network broken or something wrong, need to check current connection status and reconnect when it come error.

TypeError: Cannot call method 'setException' of undefined

After mock network recover, this problem will come out.

/Users/mk2/git/node-hbase-client/lib/connection.js:260
      call.setException(err);
           ^
TypeError: Cannot call method 'setException' of undefined
    at Connection._nextResponse (/Users/mk2/git/node-hbase-client/lib/connection.js:260:12)
    at DataInputStream.readFields.next (/Users/mk2/git/node-hbase-client/lib/data_input_stream.js:84:14)
    at DataInputStream.readFields.next (/Users/mk2/git/node-hbase-client/lib/data_input_stream.js:96:5)
    at DataInputStream.readFields (/Users/mk2/git/node-hbase-client/lib/data_input_stream.js:99:3)
    at Readable.g (events.js:192:14)
    at Readable.EventEmitter.emit (events.js:93:17)
    at emitReadable_ (/Users/mk2/git/node-hbase-client/node_modules/readable-stream/lib/_stream_readable.js:385:10)
    at emitReadable (/Users/mk2/git/node-hbase-client/node_modules/readable-stream/lib/_stream_readable.js:380:5)
    at readableAddChunk (/Users/mk2/git/node-hbase-client/node_modules/readable-stream/lib/_stream_readable.js:145:7)
    at Readable.push (/Users/mk2/git/node-hbase-client/node_modules/readable-stream/lib/_stream_readable.js:115:10)

Wont continue work when hbase clusters restart

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Client.EventEmitter.addListener (events.js:160:15)
    at Client.EventEmitter.once (events.js:185:8)
    at Client.ensureZookeeperTrackers (/Users/mk2/git/node-hbase-client/lib/client.js:530:8)
    at Client.locateRegion (/Users/mk2/git/node-hbase-client/lib/client.js:491:8)
    at Client._action (/Users/mk2/git/node-hbase-client/lib/client.js:167:8)
    at Client.get (/Users/mk2/git/node-hbase-client/lib/client.js:132:8)
    at Client.getRow (/Users/mk2/git/node-hbase-client/lib/client.js:334:8)
    at get (/Users/mk2/git/node-hbase-client/examples/split_regions.js:62:10)
    at wrapper [as _onTimeout] (timers.js:252:14)
    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

TypeError: Cannot call method 'warn' of undefined

Hi,
I do get the following error when running this module.

../node_modules/hbase-client/lib/client.js:720
self.logger.warn('[%s, startRow:%s] prefetchRegionCache %d locatio
TypeError: Cannot call method 'warn' of undefined

If I remove all occurrences of self.logger.warn and this.logger.warn the module works as expected.

I am running the example on node version 10.6 with HBase 0.92.1. I would appreciate any help.

RegionServerStoppedException need to close connection.

org.apache.hadoop.hbase.regionserver.RegionServerStoppedException: org.apache.hadoop.hbase.regionserver.RegionServerStoppedException: Server dw50.kgb.sqa.cm4,36020,1368498081808 not running, aborting
    at org.apache.hadoop.hbase.regionserver.HRegionServer.checkOpen(HRegionServer.java:3530)
    at org.apache.hadoop.hbase.regionserver.HRegionServer.get(HRegionServer.java:2206)
    at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.hadoop.hbase.ipc.SecureRpcEngine$Server.call(SecureRpcEngine.java:389)
    at org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1689)

Error: write EPIPE
Error: write EPIPE

getHRegionConnection: (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Client.EventEmitter.addListener (events.js:175:15)
    at Client.EventEmitter.once (events.js:196:8)
    at Client.getHRegionConnection (/Users/mk2/git/node-hbase-client/lib/client.js:465:8)
    at Client._action (/Users/mk2/git/node-hbase-client/lib/client.js:148:10)
    at Client.locateRegionInMeta (/Users/mk2/git/node-hbase-client/lib/client.js:371:18)
    at Client.getHRegionConnection (/Users/mk2/git/node-hbase-client/lib/client.js:461:12)
    at Client.locateRegionInMeta (/Users/mk2/git/node-hbase-client/lib/client.js:357:10)
    at Call.Client.locateRegionInMeta (/Users/mk2/git/node-hbase-client/lib/client.js:434:9)
    at Call.EventEmitter.emit (events.js:99:17)
    at Call.callComplete (/Users/mk2/git/node-hbase-client/lib/connection.js:447:8)
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Client.EventEmitter.addListener (events.js:175:15)
    at Client.EventEmitter.once (events.js:196:8)
    at Client.getHRegionConnection (/Users/mk2/git/node-hbase-client/lib/client.js:465:8)
    at Client._action (/Users/mk2/git/node-hbase-client/lib/client.js:148:10)
    at Client.locateRegionInMeta (/Users/mk2/git/node-hbase-client/lib/client.js:330:14)
    at Client.locateRegion (/Users/mk2/git/node-hbase-client/lib/client.js:239:12)
    at Client.ensureZookeeperTrackers (/Users/mk2/git/node-hbase-client/lib/client.js:247:12)
    at Client.locateRegion (/Users/mk2/git/node-hbase-client/lib/client.js:225:8)
    at Client._action (/Users/mk2/git/node-hbase-client/lib/client.js:143:8)
    at Client.put (/Users/mk2/git/node-hbase-client/lib/client.js:121:8)

readFields to read

 // See HBaseServer.Call.setResponse for where we write out the response.
  // It writes the call.id (int), a flag byte, then optionally the length
  // of the response (int) followed by data.
  self.in.readFields([
    {name: 'id', method: 'readInt'},
    {name: 'flag', method: 'readByte'},
    {name: 'size', method: 'readInt'},
  ], function (err, data) {

=> read(4 + 1 + 4) => convert Int, Byte, Int

java.io.IOException……

连接成功后,进行各项操作,总是会出现[server_status, startRow:] prefetchRegionCache 0 locations [prefetchRegionCache] error: java.io.IOException: IPC server unable to read call parameters: Error in readFields ()#1) 这样的错误。

连接没问题,因为各种操作,put、get等都会出现这样的错误,感觉是配置的问题,求指点……

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Readable.EventEmitter.addListener (events.js:175:15)
    at Readable.on (/Users/mk2/git/node-hbase-client/node_modules/readable-stream/lib/_stream_readable.js:656:33)
    at Readable.EventEmitter.once (events.js:196:8)
    at DataInputStream.readFields.next (/Users/mk2/git/node-hbase-client/lib/data_input_stream.js:117:24)
    at Object.DataInputStream.readFields (/Users/mk2/git/node-hbase-client/lib/data_input_stream.js:123:5)
    at Connection.receiveResponse (/Users/mk2/git/node-hbase-client/lib/connection.js:351:11)
    at Connection.sendParam (/Users/mk2/git/node-hbase-client/lib/connection.js:335:8)
    at Connection.call (/Users/mk2/git/node-hbase-client/lib/connection.js:412:8)
    at Connection.get (/Users/mk2/git/node-hbase-client/lib/connection.js:454:8)
    at Client.get (/Users/mk2/git/node-hbase-client/lib/client.js:127:14)

Should throw error if zookeeper is not available

Hi,
I was just investigating a problem for quite some time. I had a typo in the port of my zookeeper servers. Unfortunately the hbase-client is not complaining if hbase is not reachable at all.
I think the client should throw an error if the cluster is not reachable at all.

Support Ping

/* Send a ping to the server if the time elapsed
         * since last I/O activity is equal to or greater than the ping interval
         */
        protected synchronized void sendPing() throws IOException {
            long curTime = System.currentTimeMillis();
            if (curTime - lastActivity.get() >= pingInterval) {
                lastActivity.set(curTime);
                //noinspection SynchronizeOnNonFinalField
                synchronized (this.out) {
                    out.writeInt(PING_CALL_ID);
                    out.flush();
                }
            }
        }

`NotServingRegionException` when querying, need to close the connection.

org.apache.hadoop.hbase.NotServingRegionException: org.apache.hadoop.hbase.NotServingRegionException: Region is not online: tcif_acookie_user,e2ad9XS3CcZPpHcCAe7mrz1owHJk,1363768326401.1caa6547edc73dd6da043684dad422c3.
    at org.apache.hadoop.hbase.regionserver.HRegionServer.getRegion(HRegionServer.java:3518)
    at org.apache.hadoop.hbase.regionserver.HRegionServer.get(HRegionServer.java:2247)
    at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.hadoop.hbase.ipc.WritableRpcEngine$Server.call(WritableRpcEngine.java:361)
    at org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1642)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.