【问题标题】:Node.JS - node-hbase Scan not working for more than 1000 recordsNode.JS - node-hbase 扫描无法处理超过 1000 条记录
【发布时间】:2018-04-10 12:08:43
【问题描述】:

我想使用连接到其余服务器的 node-hbase 模块从 HBase 表中获取记录到 Node.JS 代码中。但是在第一批之后我无法获得下一组记录。 所以我的最终计数是 1000(这是批量大小)。但实际大小是7000多。

var hbase = require('hbase');
var client = hbase({ host: 'localhost', port: '17001', headers: { 'Connection': 'Keep-Alive' } });

var scanner = client
                .table(tblName)
                .scan({});
var rows = [];
scanner.on('readable', function(){
    var chunk;
    //_results = [];
    while (chunk = scanner.read()) {
        rows.push(chunk);
    }        
    });
scanner.on('error', function(err) {
    console.error(err);
    });
scanner.on('end', function(){
    console.log(rows.length); 
    })

【问题讨论】:

  • 你试过使用 setMaxResultSize(long) 吗?
  • @AniruddhaGohad 此模块的扫描仪没有此类功能。
  • @AniruddhaGohad 这是这个模块的仓库。 github.com/adaltas/node-hbase

标签: javascript node.js rest npm hbase


【解决方案1】:

关于扫描仪的选项:https://hbase.js.org/api/scanner/

batch
Number of cells returned on each iteration, internal use, default to "1000".

你可以设置

const scanner = client
.table('node_table')
.scan({
  ...
   batch: 100000
  ...
})

或者您可以检查服务器上的限制内存!

【讨论】:

    猜你喜欢
    • 2021-01-18
    • 1970-01-01
    • 2017-05-21
    • 1970-01-01
    • 2016-01-16
    • 1970-01-01
    • 1970-01-01
    • 2018-08-16
    • 2019-04-11
    相关资源
    最近更新 更多