HBase
HBase Create Table with Example
In HBase, we can create table operations in two ways Shell command JAVA API We will learn to use...
In this tutorial- you will learn,
Apache HBase can be installed in three modes. The features of these modes are mentioned below.
1) Standalone mode installation (No dependency on Hadoop system)
2) Pseudo-Distributed mode installation (Single node Hadoop system + HBase installation)
3) Fully Distributed mode installation (MultinodeHadoop environment + HBase installation)
For Hadoop installation Refer this URL Here
Step 1) Go to the link here to download HBase. It will open a webpage as shown below.
Step 2) Select stable version as shown below 1.1.2 version
Step 3) Click on the hbase-1.1.2-bin.tar.gz. It will download tar file. Copy the tar file into an installation location.
Installation is performed on Ubuntu with Hadoop already installed.
Step 1) Place hbase-1.1.2-bin.tar.gz in /home/hduser
Step 2) Unzip it by executing command $tar -xvf hbase-1.1.2-bin.tar.gz. It will unzip the contents, and it will create hbase-1.1.2 in the location /home/hduser
Step 3) Open hbase-env.sh as below and mention JAVA_HOME path in the location.
Step 4) Open ~/.bashrc file and mention HBASE_HOME path as shown in below
| export HBASE_HOME=/home/hduser/hbase-1.1.1 export PATH= $PATH:$HBASE_HOME/bin |
Step 5) Open hbase-site.xml and place the following properties inside the file
hduser@ubuntu$ gedit hbase-site.xml(code as below)
<property> <name>hbase.rootdir</name> <value>file:///home/hduser/HBASE/hbase</value> </property> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/home/hduser/HBASE/zookeeper</value> </property>
Here we are placing two properties
All HMaster and ZooKeeper activities point out to this hbase-site.xml.
Step 6) Open hosts file present in /etc. location and mention the IPs as shown in below.
Step 7) Now Run Start-hbase.sh in hbase-1.1.1/bin location as shown below.
And we can check by jps command to see HMaster is running or not.
Step8) HBase shell can start by using "hbase shell" and it will enter into interactive shell mode as shown in below screenshot. Once it enters into shell mode, we can perform all type of commands.
The standalone mode does not require Hadoop daemons to start. HBase can run independently.
This is another method for Apache Hbase Installation, known as Pseudo Distributed mode of Installation. Below are the steps to install HBase through this method.
Step 1) Place hbase-1.1.2-bin.tar.gz in /home/hduser
Step 2) Unzip it by executing command$tar -xvf hbase-1.1.2-bin.tar.gz. It will unzip the contents, and it will create hbase-1.1.2 in the location /home/hduser
Step 3) Open hbase-env.sh as following below and mention JAVA_HOME path and Region servers' path in the location and export the command as shown
Step 4) In this step, we are going to open ~/.bashrc file and mention the HBASE_HOME path as shown in screen-shot.
Step 5) Open HBase-site.xml and mention the below properties in the file.(Code as below)
<property> <name>hbase.rootdir</name> <value>hdfs://localhost:9000/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>hbase.zookeeper.quorum</name> <value>localhost</value> </property> <property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>hbase.zookeeper.property.clientPort</name> <value>2181</value> </property> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/home/hduser/hbase/zookeeper</value> </property>
In the fully distributed mode, multiple data nodes present so we can increase replication by placing more than 1 value in the dfs.replication property
Step 6) Start Hadoop daemons first and after that start HBase daemons as shown below
Here first you have to start Hadoop daemons by using"./start-all.sh" command as shown in below.
After starting Hbase daemons by hbase-start.sh
Now check jps
1) Problem Statement: Master server initializes but region servers not initializes
The Communication between Master and region servers through their IP addresses. Like the way Master is going to listen that region servers are running or having the IP address of 127.0.0.1. The IP address 127.0.0.1 which is the local host and resolves to the master server own local host.
Cause:
In dual communication between region servers and master, region server continuously informs Master server about their IP addresses are 127.0.0.1.
Solution:
What to change:
Open /etc./hosts and go to this location
127.0.0.1 fully.qualified.regionservernameregionservername localhost.localdomain localhost : : 1 localhost3.localdomain3 localdomain3
Modify the above configuration like below (remove region server name as highlighted above)
127.0.0.1 localhost.localdomainlocalhost : : 1 localhost3.localdomain3 localdomain3
2) Problem Statement: Couldn't find my address: XYZ in list of Zookeeper quorum servers
Cause:
Solution:-
3) Problem Statement: Created Root Directory for HBase through Hadoop DFS
Cause:
1) Root directory not to exist
2) HBase previous running instance initialized before
Solution:
Step 1) Using Hadoop dfs to delete the HBase root directory
Step 2) HBase creates and initializes the directory by itself
4) Problem statement: Zookeeper session expired events
Cause:
The following shows the exception thrown because of Zookeeper expired event. The highlighted events are some of the exceptions occurred in log file
Log files code as display below:
WARN org.apache.zookeeper.ClientCnxn: Exception closing session 0x278bd16a96000f to sun.nio.ch.SelectionKeyImpl@355811ec java.io.IOException: TIMED OUT at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:906) WARN org.apache.hadoop.hbase.util.Sleeper: We slept 79410ms, ten times longer than scheduled: 5000 INFO org.apache.zookeeper.ClientCnxn: Attempting connection to server hostname/IP:PORT INFO org.apache.zookeeper.ClientCnxn: Priming connection to java.nio.channels.SocketChannel[connected local=/IP:PORT remote=hostname/IP:PORT] INFO org.apache.zookeeper.ClientCnxn: Server connection successful WARN org.apache.zookeeper.ClientCnxn: Exception closing session 0x278bd16a96000d to sun.nio.ch.SelectionKeyImpl@3544d65e java.io.IOException: Session Expired at org.apache.zookeeper.ClientCnxn$SendThread.readConnectResult(ClientCnxn.java:589) at org.apache.zookeeper.ClientCnxn$SendThread.doIO(ClientCnxn.java:709) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:945) ERROR org.apache.hadoop.hbase.regionserver.HRegionServer: ZooKeeper session expired
Solution:
<property>
<name> zookeeper.session.timeout </name>
<value>1200000</value>
</property>
<property>
<name> hbase.zookeeper.property.tickTime </name>
<value>6000</value>
</property>
In HBase, we can create table operations in two ways Shell command JAVA API We will learn to use...
In this tutorial, you will learn: Write Data to HBase Table: Shell Read Data from HBase Table:...
After successful installation of HBase on top of Hadoop, we get an interactive shell to execute...
Download PDF Following are frequently asked questions in interviews for freshers as well...
What is HBase? HBase is an open-source, column-oriented distributed database system in a Hadoop ...
HBase architecture always has " Single Point Of Failure " feature, and there is no exception...