HBase Installation Guide

Environment Setup

  • Install Java 1.6+ version.
  • Install latest Apache stable build.
  • Download HBase stable version.

HBase Installation

Download the stable version of HBase. In our case it is HBase 0.94.16.

  • Execute following command to download HBase 0.94.16
  • Unzip the compressed hbase file by executing the following command:
    tar –xvzf hbase-0.94.16.tar.gz
  • Login as root and create a directory “hbase”, Change the ownership of this directory to the hadoop user “hduser” and group “hadoop”. This is done mainly for our convenience, to differentiate each framework, software and application with different users. Execute the following commands
    cd /usr/local
    mkdir hbase
    chown -R hduser:hadoop /usr/local/hbase
  • Copy the unzipped hbase binaries into /usr/local/hbase folder
    mv hbase-0.94.16 /usr/local/hbase
  • Start HBase by executing the following command.
    starting Master, logging to logs/
  • Hbase is now set up and is ready for further use. HBase logs can be found in the logs subdirectory. Check them out especially if it seems HBase had trouble starting.
  • Stop HBase by executing the following command.
    stopping hbase...............

HBase Shell

Once the HBase server is started, it is ready to be used.

  • Connect to HBase shell by executing the following command
    ./bin/hbase shell
    HBase Shell; enter 'help<RETURN>' for list of supported commands.
    Type "exit<RETURN>" to leave the HBase Shell
    Version 0.94.16, r1557241, Fri Jan 10 20:43:03 UTC 2014 hbase(main):001:0>
  • Create a table named test with columns cf1 and cf2.
    hbase(main):001:0> create 'test', ‘cf’
    0 row(s) in 2.4010 seconds
  • Check if the table is created properly by executing the following command.
    hbase(main):002:0> list 'test'
    1 row(s) in 0.0370 seconds
  • Add data to the table by executing the following command.
    hbase(main):004:0> put 'test', 'row1', 'cf:a', 'value1'
    0 row(s) in 0.0560 seconds
    hbase(main):005:0> put 'test', 'row2', 'cf:b', 'value2
    0 row(s) in 0.0370 seconds
    hbase(main):006:0> put 'test', 'row3', 'cf:c', 'value3'
    0 row(s) in 0.0450 seconds
  • Verify the data insert by running a scan of the table as follows
    hbase(main):007:0> scan 'test'
    row1 column=cf:a, timestamp=1288380727188, value=value1
    row2 column=cf:b, timestamp=1288380738440, value=value2
    row3 column=cf:c, timestamp=1288380747365, value=value3
    3 row(s) in 0.0590 seconds
  • To get a single row from table, execute the following command
    hbase(main):008:0> get 'test', 'row1'
    cf:a timestamp=1288380727188, value=value1
    1 row(s) in 0.0400 seconds
  • To exit from hbase shell, execute the following command
    hbase(main):008:0> exit




Sign Up for Updates

Your information will be protected.


Please fill in ALL fields with correct information. Your information will be protected.