Thursday, March 12, 2015

CDH3 HBase Installation


Install the HBase package on master node

#yum install hadoop-hbase-master
#yum install hadoop-zookeeper-server
#yum install hadoop-hbase-regionserver

Configuring Hadoop on master node

Now you have to configure the hadoop on master in /usr/local/hadoop/conf:- hadoop-env.sh
Set your JAVA_HOME to where the java package is installed (this should be already set from hadoop
installation). On CentOS 6:
The java implementation to use. Required.
#export JAVA_HOME=/usr/java/jdk1.7.0_03

Add the hbase path to the HADOOP_CLASSPATH:

Extra Java CLASSPATH elements. Optional.
#export HADOOP_CLASSPATH=/usr/lib/hbase/hbase-0.90.6-cdh3u4.jar:/usr/lib/hbase-0.90.6-cdh3u4-tests.jar:/usr/lib/hbase/conf:/usr/lib/hbase/lib/zookeeper.jar

Copy the updated hadoop-env.sh to all slaves:

#hadoop@master:~$ scp -r /usr/lib/hadoop/conf/hadoop-env.sh ip_address_of_slavenode_i:/usr/lib/hadoop/conf/

Formatting the HDFS

Format the filesystem (which simply initializes the directory specified by the dfs.name.dir variable on the
namenode):
#hadoop@master:~$ /usr/lib/hadoop/bin/hadoop namenode -format

Configuring HBase

Now, login as hadoop and go to its conf directory:
#superuser@master:/usr/local$ sudo -i -u hdfs
without requesting password)
#hadoop@master:~$ cd /usr/lib/hbase/conf
(log in as hadoop user a/ Then update the Java classpath in hbase-env.sh, just like you did for hadoop-env.sh Change

The java implementation to use. Required.
#export JAVA_HOME=/usr/lib/j2sdk1.5-sun
to
The java implementation to use. Required.
#export JAVA_HOME=/usr/java/jdk1.7.0_03

and
add the hadoop conf directory to the HBASE_CLASSPATH:

#export HBASE_CLASSPATH=/usr/local/hadoop/conf
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. To toggle HBase management of ZooKeeper, use the
HBASE_MANAGES_ZK variable in ${HBASE_HOME}/conf/hbase-env.sh. This variable, which defaults to
true, tells HBase whether to start/stop the ZooKeeper quorum servers alongside the rest of the servers. So,
for the master you will want to say:

#export HBASE_MANAGES_ZK=true

b/ Inside hbase-site.xml, configure hbase.roodir and hbase.master. The result should look something like

<configuration>
        <property>
                <name>hbase.master</name>
                <value>master:60000</value>
                <description>The host and port that the HBase master runs at.</description>
        </property>
        <property>
                <name>hbase.zookeeper.quorum</name>
                <value>master</value>
        </property>
        <property>
                <name>hbase.cluster.distributed</name>
                <value>true</value>
                <description>The mode the cluster will be in. Possible values ar
                false: standalone and pseudo-distributed setups with managed Zookeeper
                ntrue: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)           <description>                                                           
        </property>
        <property>
                <name>hbase.zookeeper.property.maxClientCnxns</name>
                <value>300</value>
        </property>
        <property>
                <name>hbase.rootdir</name>
                <value>hdfs://master:8020/hbase</value>
        </property>
        <property>
                <name>hbase.tmp.dir</name>
                <value>/tmp/hbase</value>
                <description>Temporary directory on the local filesystem.</description>
        </property>
        <property>
                <name>hfile.block.cache.size</name>
                <value>0.2</value>
        </property>
        <property>
                <name>hbase.regionserver.lease.period</name>
                <value>300000</value>
        </property>
        <property>
                <name>zookeeper.session.timeout</name>
                <value>300000</value>
        </property>
</configuration>


Remote copy hbase folder from master node to slave nodes

Run the following command from the master node for each slave node:
#hadoop@master:~$ scp -r /usr/lib/hbase  ip_address_of_slavenode_i:/usr/lib/hbase

This should copy our entire set-up to the node without having to go through unzipping and all the
subsequent steps from that.

Start up HBase

#service hadoop-hbase-master start
#service hadoop-zookeeper-server start
#service hadoop-hbase-regionserver start


Check if HBase is up and running

Open up the HBase Web UI e.g. http://master_hostname:60010/