HBASE-5069 [book] Document how to count rows

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1415733 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2012-11-30 16:43:08 +00:00
parent 813cd30de5
commit 82faf90366
2 changed files with 56 additions and 43 deletions

View File

@ -266,8 +266,10 @@ row10 c1 c2
</section> </section>
<section xml:id="rowcounter"> <section xml:id="rowcounter">
<title>RowCounter</title> <title>RowCounter</title>
<para>RowCounter is a utility that will count all the rows of a table. This is a good utility to use <para>RowCounter is a mapreduce job to count all the rows of a table. This is a good utility to use
as a sanity check to ensure that HBase can read all the blocks of a table if there are any concerns of metadata inconsistency. as a sanity check to ensure that HBase can read all the blocks of a table if there are any concerns of metadata inconsistency.
It will run the mapreduce all in a single process but it will run faster if you have a MapReduce cluster in place for it to
exploit.
<programlisting>$ bin/hbase org.apache.hadoop.hbase.mapreduce.RowCounter &lt;tablename&gt; [&lt;column1&gt; &lt;column2&gt;...] <programlisting>$ bin/hbase org.apache.hadoop.hbase.mapreduce.RowCounter &lt;tablename&gt; [&lt;column1&gt; &lt;column2&gt;...]
</programlisting> </programlisting>
</para> </para>

View File

@ -104,5 +104,16 @@
</para> </para>
</section> </section>
</section> </section>
<section><title>Commands</title>
<section><title>count</title>
<para>Count command returns the number of rows in a table.
It's quite fast when configured with the right CACHE
<programlisting>hbase> count '&lt;tablename&gt;', CACHE => 1000</programlisting>
The above count fetches 1000 rows at a time. Set CACHE lower if your rows are big.
Default is to fetch one row at a time.
</para>
</section>
</section>
</section> </section>
</chapter> </chapter>