hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Hadoop Wiki] Trivial Update of "Hbase/Shell" by stack
Date Sat, 16 Aug 2008 21:17:10 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.

The following page has been changed by stack:

The comment on the change is:
Update help and add how to go from log date to timestamp; useful debugging

             hbase> alter 't1', {NAME => 'f1', VERSIONS => 5}
+  count     Count the number of rows in a table. This operation may take a LONG
+            time (Run '$HADOOP_HOME/bin/hadoop jar hbase.jar rowcount' to run a
+            counting mapreduce job). Current count is shown every 1000 rows by
+            default. Count interval may be optionally specified. Examples:
+            hbase> count 't1'
+            hbase> count 't1', 100000
   create    Create table; pass table name, a dictionary of specifications per
             column family, and optionally a dictionary of table configuration.
             Dictionaries are described below in the GENERAL NOTES section.
+            Examples:
-            For example, to create a table named 't1' with a single family named
-            'f1' with an alternate maximum number of cells, type:
             hbase> create 't1', {NAME => 'f1', VERSIONS => 5}
-            To create a table with 'f1', 'f2', and 'f3' using all defaults:
             hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'}
+            hbase> # The above in shorthand would be the following:
-            or in shorthand:
             hbase> create 't1', 'f1', 'f2', 'f3'
+            hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => 2592000,
+              BLOCKCACHE => true}
   describe  Describe the named table: e.g. "hbase> describe 't1'"
   delete    Put a delete cell value at specified table/row/column and optionally
@@ -73, +76 @@

   list      List all tables in hbase
-  put       Put a cell value at specified table/row/column and optionally
+  put       Put a cell 'value' at specified table/row/column and optionally
             timestamp coordinates.  To put a cell value into table 't1' at
             row 'r1' under column 'c1' marked with the time 'ts1', do:
@@ -93, +96 @@

   version   Output this HBase version
+ Quote all names in the hbase shell such as table and column names.  Don't
+ forget commas delimit command parameters.  Type <RETURN> after entering a
+ command to run it.  Dictionaries of configuration used in the creation and
+ alteration of tables are ruby Hashes. They look like this:
+   {'key1' => 'value1', 'key2' => 'value2', ...}
+ They are opened and closed with curley-braces.  Key/values are delimited by
+ the '=>' character combination.  Usually keys are predefined constants such as
+ NAME, VERSIONS, COMPRESSION, etc.  Constants do not need to be quoted.  Type
+ 'Object.constants' to see a (messy) list of all constants in the environment.
+ This HBase shell is the JRuby IRB with the above HBase-specific commands added.
+ For more on the HBase Shell, see http://wiki.apache.org/hadoop/Hbase/Shell
  === General Notes ===
@@ -146, +164 @@

  IRB.conf[:SAVE_HISTORY] = 100
  IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"}}}
+ === Log date to timestamp ===
+ To convert the date '08/08/16 20:56:29' from an hbase log into a timestamp, do:
+ {{{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",
+ => 1218920189000}}}
+ To go the other direction, do:
+ {{{hbase(main):021:0> import java.util.Date
+ hbase(main):022:0> Date.new(1218920189000).toString()
+ => "Sat Aug 16 20:56:29 UTC 2008"}}}
+ To output in a format that is exactly like hbase log format is a pain messing with SimpleDateFormat.

View raw message