Install Hbase on Ubuntu in standalone mode

Friday, 6th January 2017

 



hbase_logo

Hbase like any other NoSQL databases is a columnar NoSQL database, which workswell with semi-structures as well as with structured data.

Following are the three modes of Hbase installation:

  1. Standalone mode
  2. Semi-distributed mode
  3. full distributed mode

Hbase works along with hadoop and uses Hadoop Distributed File System (HDFS) to store the data. Semi-distributed and distributed modes uses HDFS. Hbase can be configured to work with local file system by installing Hbase in standalone mode. Standalone mode is perfect for the individuals who wants to practice Hbase commands. It is strictly recommended to use Hbase alongwith Hadoop when dealing with distributed data and clusters.

As Hbase is programmed suing Java, it requires JDK to work.

Following are the steps to install Hbase in standalone mode:
Let's start with installing JDK.

  1. Head to the oracle site and download JDK file for Linux x64 (size around 170MB)
  2. Fireup a terminal and navigate to the directory where downloaded file is present
  3. Copy the file to the location "/usr/lib" using following command

    sudo cp <filename>.tar.gz /usr/lib/

    For example, assuming filename to be "jdk-8u102-linux-x64.tar.gz" then the command will look like "sudo cp jdk-8u102.linux-x64.tar.gz /usr/lib/" (without quotes)

  4. Navigate to the directory "/usr/lib"

    cd /usr/lib

  5. Extract the file using following command

    sudo tar -xvf <filename>.tar.gz

  6. Do some cleaning by removing the compressed file

    sudo rm <filename>.tar.gz

Now let's begin with the actual installation of Hbase. For the tutorial purpose we are going to use the version "0.94.8" you can use whatever version of Hbase required just by replacing the filename in following commnds.

  1. Head to the apache archives and download the Hbase package. For the tutorial purpose we are downloading the package "hbase-0.94.8.tar.gz"
  2. Fireup a terminal and navigate to the directory where downloaded file is present
  3. Extract the file

    tar -xvf hbase-0.94.8.tar.gz

  4. Do some cleaning by removing the compressed file

    rm hbase-0.94.8.tar.gz

  5. Create a directory "hbase" at location "/usr/lib"

    sudo mkdir /usr/lib/hbase

  6. Move the directory named "hbase-0.94.8" to the location "/usr/lib/hbase"

    sudo mv hbase-0.94.8 /usr/lib/hbase/hbase-0.94.8

  7. Let's create directory structure for Hbase to use local filesystem to store the data
    • cd ~

    • mkdir HBASE

    • mkdir HBASE/hbase

    • mkdir HBASE/zookeeper

  8. Navigate to the location "/usr/lib/hbase/hbase-0.94.8/conf"

    cd /usr/lib/hbase/hbase-0.94.8/conf

  9. Now we need to add the information about the directory structure we created earlier.
    Note down path to your home directory using the following command

    $HOME

  10. Open "hbase-env.sh" file using gedit and add following lines between tags <configuration> and</configuration>.

    sudo gedit hbase-env.sh

    Remember to substitute path to your home directory wherever <path_to_home> occures.
    Add the following lines
    <property>
    	<name>hbase.rootdir</name>
    	<value>path_to_home/HBASE/hbase/</value>
    </property>
    
    <property>
    	 <name>hbase.zookeeper.property.dataDir</name>
    	 <value>path_to_home/HBASE/zookeeper/</value>
    </property>

  11. Navigate to the home directory and open .bashrc file

    cd ~

    gedit .bashrc

  12. Add following lines to ".bashrc"

    export HBASE_HOME=/usr/lib/hbase/hbase-0.94.8
    export PATH=$PATH:$HBASE_HOME/bin

  13. Open "hosts" file

    sudo gedit /etc/hosts

  14. Change IP address 127.0.1.1 to 127.0.0.1

If every thing is done perfectly then you are good to go. Use following commands in the terminal to work with Hbase

To start Hbase - start-hbase.sh
To get Hbase shell - hbase shell
To stop Hbase - stop-hbase.sh

Short-cut to installation

For those who don't want to go through the above procedure, we have created an installation script which will carry out the entire installation on its own. Remember to enter your user password whenever prompted for.

Download the installation file from here and install using the following procedure

  1. Fireup a terminal and navigate to the directory wherer the downloaded file is present
  2. Extract it

    tar -xvf Project_hbase

  3. Navigate into "Project_hbase" directory

    cd Project_hbase

  4. Begin installation by executing "install.sh" script

    sh install.sh

If everything is done perfectly then you are good to go. Use above mentioned commands to start, stop and use Hbase

Have anything to add or need help, just ping

Remember "Sharing is Caring"

Managed WordPress Hosting Static New

Subscribe

Thank You...

request failed! Contact admin.

Search Your Domain Name Here

WordPress Hosting Offer July
black-seal-1

Connect...