Hbase批量查询示例

时间:2012-12-12 18:33:56

标签: batch-file hbase

我读过“hadoop设计模式”一书,“HBase支持批量查询,所以最好将我们想要执行的所有查询缓冲到某个预定大小。这个常数取决于你可以轻松存储多少条记录在查询HBase之前在内存中。“

我试图在网上搜索一些例子但找不到任何例子,有人能用java map reduce给我看看这个例子吗?

感谢。

1 个答案:

答案 0 :(得分:2)

这是你想要的吗?您可以将HBase Get对象保存在列表中并同时提交列表。它比多次调用table.get(get)好一点。

Configuration conf = HBaseConfiguration.create();
pool = new HTablePool(conf, 5);
HTableInterface table = pool.getTable('table');
List<Get> gets = new ArrayList<Get>();
table.get(gets);