Thursday, 18 April 2013

Installation and Configuration of HBase


 HBase is an open-source, distributed, versioned, column-oriented store modeled.

 A distributed HBase depends on a running ZooKeeper cluster. All participating nodes and clients need to be able to get to the running ZooKeeper cluster. HBase by default manages a ZooKeeper cluster for you, or you can manage it on your own and point HBase to it. In our case, we are using default ZooKeeper cluster, which is manage by Hbase Following
are the capacities in which nodes may act in our cluster:
1.Hbase Master:- The HbaseMaster is responsible for assigning regions to HbaseRegionserver, 
monitors the health of each HbaseRegionserver.
2.Zookeeper: - For any distributed application, ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.
3.Hbase Regionserver:- The HbaseRegionserver is responsible for handling client read and write requests. It communicates with the Hbasemaster to get a list of regions to serve and to tell the master that it is alive.In our case, one machine in the cluster is designated as Hbase master and Zookeeper. The rest of machine in the cluster act as a Regionserver.
 Before installation of hbase you must have to installed the hadoop in cluster.
Hbase run in three modes, Standalone, Pseudo-Distributed and Fully-Distributed.
We only gives the Fully-Distributed mode.
There are following steps for installing and configuring the hbase as
Step 1 : Download the stable version for hbase from http://www.apache.org/dyn/closer.cgi/hbase/
suppose it is donloaded into the /usr/local/ directory. Suppose you have downloaded as hbase-0.90.5.tar.gz
Step 2 : untar the downloaded file
# cd /usr/local/
# tar xvfz hbase-0.90.5.tar.gz
Step 3 :  copy the hbase-0.90.5 to all RegionServer machines
Step 4 : Edit the /etc/hosts on master-hbase machine and add the following lines
  192.168.0.50  master-namenode     hbase-master            
 192.168.0.51     datanode-1     regionserver-1                  
 192.168.0.52     datanode-2     regionserver-2                   
 192.168.0.53     datanode-3     regionserver-3                    
 192.168.0.54     datanode-3     regionserver-4

where hbase-master and master-namenode is configured on same machine and
datanode-1,regionserver-1 is configured on machine 192.168.0.51 and so on.
Step 5 : We have needed to configure password less login from hbase-master to all 
regionservers.
Execute the following commands on hbase-master machine
# ssh-keygen -t rsa
# ssh-copy-id -i ~/.ssh/id_rsa.pub  hadoop@regionserver-1
# ssh-copy-id -i ~/.ssh/id_rsa.pub  hadoop@regionserver-2
# ssh-copy-id -i ~/.ssh/id_rsa.pub  hadoop@regionserver-3
# ssh-copy-id -i ~/.ssh/id_rsa.pub  hadoop@regionserver-4
Step 6 : Open the file /usr/local/hbase-0.90.5/conf/hbase-env.sh and set the 
JAVA_HOME as
export JAVA_HOME=/user/java/java-1.6.x
Step 7 :Open the file /usr/local/hbase-0.90.5/conf/hbase-site.xml and add the
following lines in configuration element.
<property>
    <name>hbase.rootdir</name>
    <value>hdfs://java-rnd-server:9000/hbase</value>
  </property>
  <property>
    <name>dfs.replication</name>
    <value>1</value>
  </property>
  <property>
  <name>hbase.cluster.distributed</name>
 <value>true</value>
  </property>
  <property>
    <name>hbase.master</name>
    <value>hbase-master:60000</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.clientPort</name>
    <value>2222</value>
  </property>
  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>hbase-master</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/usr/local/zookeeper/hbase</value>
  </property>
Step 8 : Open the file /usr/local/hbase-0.90.5/conf/hbase-env.sh and uncomment the following line:
export HBASE_MANAGES_ZK=true
Step 9 : Open the file
/usr/local/hbase-0.90.5/conf/regionservers
and add all the regionserver machine names.
regionserver-1
regionserver-2
regionserver-3
regionserver-4
Step 10 : Edit the file /etc/hosts on the regionserver-1..4 machines and add the following lines.
192.168.41.50 master-namenode hbase-master
Step 11 : We have needed to configure password less login from regionserver-1..4 to hbase-master machine.
Execute the following commands from all regionservers to hbase-master as follows.
# su - hadoop
# ssh-keygen -t rsa
# ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop@hbase-master
Step 12 : Repeat step 7,8 for all regionservers machines.
Step 13 : go /usr/local/hbase-0.90.5/
#bin/start-hbase.sh
Step 14 : Starting the hbase shell
#bin/hbase shell
and you can access the web interface of hbase

No comments:

Post a Comment