Free Shipping

Secure Payment

easy returns

24/7 support

Beginner’s Guide for Hbase

 July 9  | 0 Comments

Before understanding what Hbase is, we need to understand why Hbase was introduced at first place.
Prior to hbase we had Relation Database Management system (RDBMS) from late 1970’s , and it helped lot of companies to implement the solutions for their problems which are in use today.
Even today there are many uses cases were RDBMS is perfect tool. Ex: Handling transactions, etc
Yet there are some problems like handling big data which cannot be solved through RDBMS .

Age of Bigdata

We live in an era where Peta bytes of data is generated on daily basis from sources like socialmedia, ecommerce etc .Because of this, companies are focusing on delivering more targeted information, such as giving recommendations or online ads which influences their success as a business. With the Emergence of new machine learning algorithm,the need for collection of data have increased drastically and with collected data, technology like hadoop is able to process it with ease.

In the past, Due to restrictions on cost required to store the data ,companies use to ignore historical data and used to retain only last N days data and keep all the remaining data as back up in tape drives.

Because of performing analytics on limited data ,resulting models were not effective.

Few companies like Google ,amazon etc, realized the importance of the data  and started developing the solutions for solving the big data problems.  These ideas were then implemented outside of Google as part of the open source Hadoop project: HDFS and Map Reduce.

But hadoop was mainly introduced for batch processing but companies also needed a database which could be used for real time responses.

So ,Google came up with the BigtableA column-oriented data base to address the real time queries.

Before going deep into Hbase and its operations, let’s first understand Column oriented database.

Column oriented databases differ from row oriented traditional databases where entire rows are stored contiguously.

In Column oriented database data are grouped by columns and subsequent columns are stored contiguously on the disk.

Storing values on a per column basis increases the efficiency when all the values are not needed.

In column oriented database values of one columns are very much similar in nature or even vary only slightly between logical rows and this makes them a very suitable candidate for compression when compared to the heterogeneous values of row oriented record structures.

Introduction to Hbase

Till now we understood the background for using HBASE and its efficiency in handling big data.

Now let’s see what Hbase is?

Hbase is the open source implementation of Google’s Big Table, with slight modifications.  Hbase was created in 2007 , it was initially  a contributions to Hadoop  and it  later became a top level Apache project.

HBase is a distributed column-oriented database built on top of the Hadoop file system  and it is horizontally scalable Meaning we can add the new nodes the Hbase as data grows.

It is well suited for sparse data sets, which are common in many big data use cases.

An HBase system comprises a set of tables. Each table contains rows and columns, much like a traditional database. Each table must have an element defined as a Primary Key, and all access attempts to HBase tables must use this Primary Key.

It is a part of the Hadoop ecosystem that provides random real-time read/write access to data in the Hadoop File System.

Below description summarizes the difference between Hbase and RDBMS.


HBase is schema-less ,i.e there is no predefined schema for hbase tables.  RDBMS Tables have Fixed  schema, which describes the whole structure of tables.
It is built for wide tables. HBase is horizontally scalable. It is thin and built for small tables. Hard to scale.
No transactions are there in HBase. RDBMS is transactional.
It has de-normalized data. It will have normalized data.
It is good for semi-structured as well as structured data. It is good for structured data.

Before proceeding further we will install Hbase, Click here to download Hbase installation document.

We can interact with Hbase in two ways.

  • Through Hbase interactive shell
  • Hbase java Client API

In the blog we will see interacting Hbase through Hbase shell

Hbase shell is made up of JRuby( JRuby is Java implementation of the Ruby)  , we can login to hbase using below command

$HBASE_HOME/bin/hbase shell


Version command will display the version of hbase

List command will list all the tables present Hbase

Now we will see the hbase basic commands. Before going to the commands we will see the structure of Hbase table

Column – A single field in table

Column-family – is group of columns

Row-key-Row-key in hbase is mandatory field which serves as the unique identifier for every record.

Creating the table in Hbase

Syntax : create ‘<table-name>’,’<column-family1>’ ,’<column-family2>’ …….

In the HBase data model columns are grouped into column families, which must be defined during table creation. In Hbase we should at least have one column family. HBase currently does not do well with above three column families so keep the number of column families in your schema low.




Inserting the data into hbase

We can insert the data into hbase using PUT command

Syntax: put ‘<table-name>’,’row-key’,’columnfamily:columnname’,’value’

Row-key in hbase is mandatory field which serves as the unique identifier for every record.

Here in the below description customer is the table name and john is the row key followed by column family and its value.



Inserting second record



Getting single record from table

We should use GET command to retrieve single record from Hbase table,

Syntax: get ‘<table-name>’,’<row-key>’,’<column-family>’



Using get command to retrieve the address of john



Using get command to retrieve city of john



To get the all the records fromtable we should use scan

Syntax : scan ‘<table -name>’



Deleting records

Deleting entire record from table



Deleting specific column from table



Counting number of rows in the table



Version in hbase

Updating tables means replacing the previous value with the new one. But in Hbase if we try to rewrite the column values in Hbase, it does not overwrite the existing value but rather stores different values per row by time (and qualifier). Excess versions are removed during major compaction. The number of max versions may need to be increased or decreased depending on application needs.

Default version in hbase is 1 , we can modify and increase or decrease the versions  to be stored using alter command:



Dropping table

Before dropping the table we should disable the table

disable ‘table-name’


drop ‘table-name’

We hope this blog helped you in getting brief overview of hbase and its implementation in hadoop.