在Hbase表中使用Rowcounter [英] Using Rowcounter in Hbase table
问题描述
我正在尝试计算Hbase表中的行数.可以用scannner做到这一点,但这是一个庞大的过程.想使用RowCounter从Hbase表中获取行号.有什么方法可以在Java代码中使用它.是否有任何示例或代码段可用. 通过使用命令:-
I am trying to calculate the no of rows in a Hbase table. Can do that with scannner but it is a bulky process.Want to use RowCounter to fetch the row number from Hbase table.Is there any way by which I can use that in Java Code. Is there any example or code snippet available. Directly using rowcounter is plain simple by using the command :-
/hbase org.apache.hadoop.hbase.mapreduce.RowCounter [TABLE_NAME]
请提供任何代码段以在Java代码中使用相同的代码段.
Please provide any code snippet to use the same in Java code.
谢谢
推荐答案
To get the row count, we have to scan the hbase table. there is no other option. However, the way we handle the scan makes difference. The above map reduce RowCounter, is the fastest way to get the row count in Hbase. Since map reduce works in parallel, and then counts, we get fast results.
通过查看上面的源代码,您也可以自己进行操作,然后从其中删除不需要的内容.
You can do it, yourself too, by looking into the above source code, and remove unwanted thing from there.
此处,您可以找到有关API之间交互的API信息映射reduce和hbase
Here, you can find information about API provided for interaction between map reduce and hbase
这篇关于在Hbase表中使用Rowcounter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!