问题
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