Friday 19 June 2015

Steps to Install and Configure HBase on Apache Hadoop Cluster 2.0


HBase is one of the NOSQL Database which stores data in the form of column oriented key value pairs. Through HBase, we can perform real time data analytic. HFile or Map file is the data storage architecture for HBase.

Let us see the steps to install and configure HBase. Hadoop components should have installed and configured prior to HBase setup.

Step:1 [Download and extract the Hbase stable version]

>> tar -zxvf hbase-1.0.1.1-bin.tar.gz

Shift to super user mode and move the HBase folder to /usr/lib as shown below.

>> su
>> mv hbase-1.0.1.1-bin/* Hbase/

Step:2 [Configure hbase-env.sh]

Set the JAVA_HOME environment variable here.

>> cd /usr/lib/Hbase/conf
>> gedit hbase-env.sh

export JAVA_HOME=/usr/lib/jvm/java-1.7.0

Step:3 [Configure hbase-site.xml]

>> cd /usr/lib/Hbase/conf
>> gedit hbase-site.xml

<configuration>
   //Here we have to set the path where we want HBase to store its files.
   <property>
      <name>hbase.rootdir</name>
      <value>file:/home/hadoop/Hbase/HFiles</value>
   </property>
   //Here we have to set the path where we want HBase to store its built in zookeeper  files.
   <property>
      <name>hbase.zookeeper.property.dataDir</name>
      <value>/home/hadoop/zookeeper</value>
   </property>

   //It will mention in which mode HBase should be run
   <property>
     <name>hbase.cluster.distributed</name>
     <value>true</value>
   </property>

   //HDFS instance address, using the hdfs:// URI syntax. We are running HDFS on the localhost at port 8030
   <property>
     <name>hbase.rootdir</name>
     <value>hdfs://localhost:8030/hbase</value>
   </property>
</configuration>

Step:4 [Setting up Java Environment]

HBase also provides JAVA API libraries in order to manage the HBase table from application. So we need to set the classpath for HBase libraries (lib folder in HBase) as shown below.

>> gedit ~/.bashrc

export CLASSPATH = $CLASSPATH://home/hadoop/hbase/lib/*

Step:5 [Start hbase services and verify the status]

Start HBase as below

>> cd /usr/lib/Hbase
>> .bin/start-hbase.sh

Start Hbase Master Server as below.

>> .bin/local-master-backup.sh start 2
  • Number signifies specific server
  • Using the "local-master-backup.sh" we can start up to 10 servers 
  • ./bin/local-master-backup.sh 2 4
  • To kill a backup master, we need its process id, which will be stored in a file named "/tmp/hbase-USER-X-master.pid"
  • Below command to kill the backup master
>> cat /tmp/hbase-user-1-master.pid |xargs kill -9


Start Region Server as below

>> .bin/local-regionservers.sh start 3

Start HBase shell as below.

>> cd bin
>>./hbase shell

To access Hbase web interface

http://localhost:60010


No comments:

Post a Comment