Using Rowcounter in Hbase table

本秂侑毒 提交于 2020-01-03 04:16:04

问题


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]

Please provide any code snippet to use the same in Java code.

Thanks


回答1:


You can find the source code of the above here.

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.

Here, you can find information about API provided for interaction between map reduce and hbase



来源:https://stackoverflow.com/questions/32227462/using-rowcounter-in-hbase-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!