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: http://wiki.apache.org/hadoop/Hbase/Shell ------------------------------------------------------------------------------ This page describes the JRuby IRB-based HBase Shell added in HBase 0.2.x. It replaces the SQL-like [:Hbase/HbaseShell: HQL], the Shell found in HBase versions 0.1.x and previous. Some discussion of new shell requirements can be found in the [:Hbase/Shell/Replacement: Shell Replacement] document. + To run the shell, do + + {{{$ ${HBASE_HOME}/bin/hbase shell}}} + + You'll be presented with a prompt like the following: + + {{{HBase Shell; enter 'help<RETURN>' for list of supported commands. + Version: 0.2.0-dev, r670701, Mon Jun 23 17:26:36 PDT 2008 + hbase(main):001:0> + }}} + + Type 'help' followed by a return to get a listing of commands. + == Commands == - TODO: Full exposition. + {{{ + alter Alter column family schema; pass table name and a dictionary + specifying new column family schema. Dictionaries are described + below in the GENERAL NOTES section. Dictionary must include name + of column family to alter. For example, to change the 'f1' column + family in table 't1' from defaults to instead keep a maximum of 5 + cell VERSIONS, do: - == Basics == + hbase> alter 't1', {NAME => 'f1', VERSIONS => 5} + + 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. + 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} + + describe Describe the named table: e.g. "hbase> describe 't1'" + + delete Put a delete cell value at specified table/row/column and optionally + timestamp coordinates. Deletes must match the deleted cell's + coordinates exactly. When scanning, a delete cell suppresses older + versions. Takes arguments like 'put' described below + + deleteall Delete all cells; pass a table name, row and optionally, a column + and timestamp + + deletefc Delete all in the named column family. Pass table name and family + + drop Drop the named table. Table must first be disabled + + disable Disable the named table: e.g. "hbase> disable 't1'" + + enable Enable the named table + + exists Does the named table exist? e.g. "hbase> exists 't1'" + + exit Type "hbase> exit" to leave the HBase Shell + + get Get row or cell contents; pass table name, row, and optionally + a dictionary of column(s), timestamp and versions. Examples: + + hbase> get 't1', 'r1' + hbase> get 't1', 'r1', {COLUMN => 'c1'} + hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']} + hbase> get 't1', 'r1', {TIMESTAMP => ts1, VERSIONS => 4} + + list List all tables in hbase + + 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: + + hbase> put 't1', 'r1', 'c1', ts1 + + scan Scan a table; pass table name and optionally an array of column + names and a dictionary of scanner specification that includes one + or more of following: LIMIT, FILTER, STARTROW, STOPROW, or TIMESTAMP. + Examples: + + hbase> scan '.META.' + hbase> scan '.META.', ['info:regioninfo'] + hbase> scan 't1', ['c1', 'c2'], {LIMIT => 10, STARTROW => 'xyz'} + + version Output this HBase version + + }}} + + === General Notes === + 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 + + == Command-line Options == A few command-line arguments can be passed the shell. Pass ''--help'' to see whats available: e.g. ''durruti:~ stack$ ./bin/hbase shell --help''. For example, its possible to point the shell at a cluster other than the one that is set in the ''hbase-site.xml'' using the ''--master=MASTER'' option.
