Skip to content

Setting up HBase to store views

Daniele Morgantini edited this page Nov 25, 2013 · 1 revision

Installing HBase

Installing Apache HBase is pretty straightforward: you just have to download the latest version from the official website and untar it in a folder of your choice.
Just a few steps divide you from starting up HBase and running a few shell commands to test it.

  • Open conf/hbase-site.xml and insert
    It's advisable to set PIG_HOME inside your bash and add PIG_HOME/bin to your path.

      <configuration>
            <property>
                  <name>hbase.rootdir</name>
                  <value>file:///DIRECTORY/hbase</value>
            </property>
            <property>
                  <name>hbase.zookeeper.property.dataDir</name>
                  <value>/DIRECTORY/zookeeper</value>
            </property>
      </configuration>   
    

Replace DIRECTORY in the above with the path to the directory you would have HBase and ZooKeeper write their data.

  • Set HBASE_HOME variable inside your bash (I advice to set it into .bashrc file):

      # Set HBASE_HOME   
      export HBASE_HOME=/home/daniele/HBase/hbase-0.94.13  
      export PIG_CLASSPATH=$PIG_HOME/pig-0.12.0-withouthadoop.jar:$HBASE_HOME/hbase-0.94.13.jar:$HBASE_HOME/lib/*:$HADOOP_HOME/lib/*   
    

You should adapt this code to your Pig and HBase versions. We're also assuming that you set HADOOP_HOME and JAVA_HOME properly.

Start HBase up

Before actually starting up HBase you should start up Hadoop.
Then you just need to type ./bin/start-hbase.sh inside your shell. The following will appear starting Master, logging to logs/hbase-user-master-example.org.out and you can refer to the log to check for errors.

Test HBase with a few shell commands

To start the interactive shell type ./bin/hbase shell.

  1. Create a table with name 'test' and column family 'cf': create 'test', 'cf'
  2. Insert a line with the command put 'test', 'row1', 'cf:a', 'value1'
  3. Verify the inserted data by running a scan of the table as follows: scan 'test'
  4. You can also retrieve a single row with the command get 'test', 'row1'
  5. Disable and drop your table: disable 'test' drop 'test'
  6. Exit the shell by typing 'exit'.

HBase status UI

To access the HBase status UI, type http://localhost:60010 in your browser. It just gives you an insight into the cluster's state and the tables it hosts.