Chapter 4. The Apache HBase Shell

Table of Contents

4.1. Scripting with Ruby
4.2. Running the Shell in Non-Interactive Mode
4.3. HBase Shell in OS Scripts
4.3.1. Checking for Success or Failure In Scripts
4.4. Read HBase Shell Commands from a Command File
4.5. Passing VM Options to the Shell
4.6. Shell Tricks
4.6.1. Table variables
4.6.2. irbrc
4.6.3. LOG data to timestamp
4.6.4. Debug
4.6.5. Commands

The Apache HBase Shell is (J)Ruby's IRB with some HBase particular commands added. Anything you can do in IRB, you should be able to do in the HBase Shell.

To run the HBase shell, do as follows:

$ ./bin/hbase shell

Type help and then <RETURN> to see a listing of shell commands and options. Browse at least the paragraphs at the end of the help emission for the gist of how variables and command arguments are entered into the HBase shell; in particular note how table names, rows, and columns, etc., must be quoted.

See Procedure 1.2, “Use HBase For the First Time” for example basic shell operation.

Here is a nicely formatted listing of all shell commands by Rajeshbabu Chintaguntla.

4.1. Scripting with Ruby

For examples scripting Apache HBase, look in the HBase bin directory. Look at the files that end in *.rb. To run one of these files, do as follows:

$ ./bin/hbase org.jruby.Main PATH_TO_SCRIPT
comments powered by Disqus