hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1030724 - /hbase/trunk/src/docbkx/book.xml
Date Wed, 03 Nov 2010 22:03:53 GMT
Author: stack
Date: Wed Nov  3 22:03:53 2010
New Revision: 1030724

URL: http://svn.apache.org/viewvc?rev=1030724&view=rev
Log:
Added notes on shell -- in particular the -d flag I just used to help me figure out fail in
shell

Modified:
    hbase/trunk/src/docbkx/book.xml

Modified: hbase/trunk/src/docbkx/book.xml
URL: http://svn.apache.org/viewvc/hbase/trunk/src/docbkx/book.xml?rev=1030724&r1=1030723&r2=1030724&view=diff
==============================================================================
--- hbase/trunk/src/docbkx/book.xml (original)
+++ hbase/trunk/src/docbkx/book.xml Wed Nov  3 22:03:53 2010
@@ -364,7 +364,77 @@ stopping hbase...............</programli
   <chapter xml:id="shell">
     <title>The HBase Shell</title>
 
-    <para></para>
+    <para>
+        The HBase Shell is <link xlink:href="http://jruby.org">(J)Ruby</link>'s
+        IRB with some HBase particular verbs addded.  Anything you can do in
+        IRB, you should be able to do in the HBase Shell.</para>
+        <para>To run the HBase shell, 
+        do as follows:
+        <programlisting>$ ./bin/hbase shell</programlisting>
+        Type <command>help</command> followed by <command>&lt;RETURN&gt;</command>
+        to see a complete listing of commands available.
+        Take some time to study the tail of the help screen where it
+        does a synopsis of IRB syntax specifying arguments -- usually you must
+        quote -- and how to write out dictionaries, etc.
+    </para>
+
+    <section><title>Scripting</title>
+        <para>For examples scripting HBase, look in the
+            HBase <filename>bin</filename> directory.  Look at the files
+            that end in <filename>*.rb</filename>.  To run one of these
+            files, do as follows:
+            <programlisting>$ ./bin/hbase org.jruby.Main PATH_TO_SCRIPT</programlisting>
+        </para>
+    </section>
+
+    <section><title>Shell Tricks</title>
+        <section><title><filename>irbrc</filename></title>
+                <para>Create an <filename>.irbrc</filename> file for yourself
in your
+                    home directory. Add HBase Shell customizations. A useful one is
+                    command history:
+                    <programlisting>
+                        $ more .irbrc
+                        require 'irb/ext/save-history'
+                        IRB.conf[:SAVE_HISTORY] = 100
+                        IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
+                    </programlisting>
+                </para>
+        </section>
+        <section><title>Log data to timestamp</title>
+            <para>
+                To convert the date '08/08/16 20:56:29' from an hbase log into a timestamp,
do:
+                <programlisting>
+                    hbase(main):021:0> import java.text.SimpleDateFormat
+                    hbase(main):022:0> import java.text.ParsePosition
+                    hbase(main):023:0> SimpleDateFormat.new("yy/MM/dd HH:mm:ss").parse("08/08/16
20:56:29", ParsePosition.new(0)).getTime() => 1218920189000
+                </programlisting>
+            </para>
+            <para>
+                To go the other direction:
+                <programlisting>
+                    hbase(main):021:0> import java.util.Date
+                    hbase(main):022:0> Date.new(1218920189000).toString() => "Sat Aug
16 20:56:29 UTC 2008"
+                </programlisting>
+            </para>
+            <para>
+                To output in a format that is exactly like hbase log format is a pain messing
with
+                <link xlink:href="http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat</link>.
+            </para>
+        </section>
+        <section><title>Debug</title>
+            <section><title>Shell debug switch</title>
+                <para>You can set a debug switch in the shell to see more output
+                    when you run a command:
+                    <programlisting>hbase> debug &lt;RETURN&gt;</programlisting>
+                 </para>
+            </section>
+            <section><title>DEBUG log level</title>
+                <para>To enable DEBUG level logging in the shell, launch it with the
<command>-d</command> option.
+                    <programlisting>$ ./bin/hbase shell -d</programlisting>
+               </para>
+            </section>
+         </section>
+    </section>
   </chapter>
 
   <chapter xml:id="datamodel">



Mime
View raw message