Monday 25 May 2015

Hbase Installation in fully distributed mode

Hbase installation need some prerequisites.  Hbase is very particular on certain prerequisites like DNS and it is important that, we have to set up the prerequisites before starting with the installation procedure.

Some of the prerequisites are:

PREREQUISITE 1: DNS RESOLUTION:

Both forward and reverse resolution must be possible for all hostnames. If you are in a local environment, either setup a local DNS server or take the help of "/etc/hosts" file to make this possible.

PREREQUISITE 2:  PASSWORDLESS LOGIN

We need to setup key based SSH authentication within the Master server and from the Master server to all Region Servers.

To setup ssh key authentication follow the link below:
--------
http://www.maninmanoj.com/2013/08/how-to-perform-ssh-login-without.html
---------

PREREQUISITE 3: A RUNNING HDFS CLUSTER.

A running HDFS cluster should be available.

PREREQUISITE 4: INSTALL JAVA.

Java must be installed in the server. Refer the following link for details:
------
http://www.maninmanoj.com/2015/03/installing-java-7-jdk-7u75-on-linux.html
------

PLAN OF ACTION: 

In our lab setup, we have a HDFS cluster  with server  IP "192.168.150.213" and is the namenode.
We are planning to setup a HBASE cluster with following specs:

HMASTER
--------
192.168.150.213
--------

REGION SERVERS:
--------
192.168.150.207
192.168.150.208
192.168.150.209
---------

A NOTE ON COMPATABILITY :

hadoop-1.0.4 and hadoop-1.0.3 versions of Hadoop work fine with all hbase versions of the series 0.94.x and 0.92.x, but not the 0.90.x series and the older releases due to version incompatibility.

PROCEDURE:
--------
STEP 1: Download stable release of hbase from the following link:

http://apache.techartifact.com/mirror/hbase/

and untar it to "/usr/local" and rename the directory to "/usr/local/hbase"
--------

STEP 2: EDITING  "hbase-env.sh"

Before explaining about more, let me take a deviation. We can setup hbase cluster in two ways:

Case 1)  Hbase manages it's own instance of Zookeeper

If we set the parameter "HBASE_MANAGES_ZK=true", then whenever we start/stop hbase, zookeeper will be started/stopped along with the same. The zookeeper instances are started on all regionservers by default.


Case 2)  Hbase do not manage Zookeeper.

If we set the parameter "HBASE_MANAGES_ZK=false", then we will have to start/stop zookeeper separately.


So, we will discuss "CASE 1" first, then we will move to "CASE 2".


CASE 1: Hbase manages Zookeeper. (Not recommended)

This is not recommended because it will be difficult to isolate the issues when it comes to troubleshooting. So, it is better to keep Zookeeper and Hbase separately.

Edit the file "/usr/local/hbase/conf/hbase-env.sh" and append the following two parameters:
-------
export JAVA_HOME=/opt/jdk1.7.0_75 ----> check the java path in your system.
export HBASE_MANAGES_ZK=true
-------

Copy this file to all regionservers too.

STEP 3: Edit "/usr/local/hbase/conf/hbase-site.xml" as below:
-------------
<configuration>

 <property>
 <name>hbase.master</name>
 <value>192.168.150.213:60000</value>
 </property>

<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>

<property>
<name>hbase.rootdir</name>
<value>hdfs://192.168.150.213:10001/hbase</value>
 </property>

</configuration>
----------------

Explanation:

hbase.master--> 192.168.150.213 is the IP of master and 60000 is the port.

hbase.cluster.distributed--> States it is a distributed cluster.

hbase.rootdir ----> The path to HDFS. No need to create the folder "hbase", it will be created by hbase.

Note: Once done, copy the file "/usr/local/hbase/conf/hbase-site.xml" to all region servers too.


STEP 4: Editing "/usr/local/hbase/conf/regionservers".

Open the file, with "vi editor" and mention the IP address of regionservers in the file.

In our configuration, the file looks as below:




CASE 2: Hbase DO NOT manage Zookeeper.

STEP 1: Edit the file "/usr/local/hbase/conf/hbase-env.sh" and append the following two parameters:
-------
export JAVA_HOME=/opt/jdk1.7.0_75 ----> check the java path in your system.
export HBASE_MANAGES_ZK=false
-------

Copy this file to all regionservers.


STEP 2: Edit "/usr/local/hbase/conf/hbase-site.xml" as below:
-------------
<configuration>

 <property>
 <name>hbase.master</name>
 <value>192.168.150.213:60000</value>
 </property>

<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>

<property>
<name>hbase.rootdir</name>
<value>hdfs://192.168.150.213:10001/hbase</value>
 </property>

 <property>
 <name>hbase.zookeeper.quorum</name>
 <value>192.168.150.207,192.168.150.208,192.168.150.209</value>
 </property>

</configuration>
----------------

Explanation:

hbase.zookeeper.quorum---> This property tells HBASE, which will be the ZOOKEEPER servers in the cluster.

Note: Once done, copy the file "/usr/local/hbase/conf/hbase-site.xml" to all region servers too.


STEP 3: Editing "/usr/local/hbase/conf/regionservers".

Open the file, with "vi editor" and mention the IP address of regionservers in the file.

In our case region servers are 192.168.150.207, 192.168.150.208, 192.168.150.209.

To Start Hbase Cluster:
------
/usr/local/hbase/bin/start-hbase.sh
------

To Stop Hbase Cluster:
-----
/usr/local/hbase/bin/stop-hbase.sh
-----


No comments:

Post a Comment

Note: only a member of this blog may post a comment.