Row counter

The count command in HBase Shell is a straightforward way to count the row numbers on an HBase table. However, running the count command on a table with a huge amount of data might take a long time to complete. A better approach for this case is to use the RowCounter class. This class will kick a MapReduce job to count the row number on a table, which is much more efficient than the count command.

We will describe the usage of RowCounter in this recipe.

Getting ready

Make sure your Hadoop and HBase clusters are running. MapReduce is also required; if it is not running, start it by using the following command on your JobTracker server:

hadoop@master1$ $HADOOP_HOME/bin/start-mapred.sh

Log in to your HBase client node.

How to do it...

Get HBase Administration Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.