Saturday, May 5, 2018

Hbase - Architecture

Hbase architecture works in similar fashion like the Master Slave architecture.The complete architecture is divided into the three parts :-  HMaster , HRegions and Zookeeper.

HRegion Server :-  The table and the data is  stored in the Regions and  are  handled by the HRegion Servers.A Hbase can have multiple Region servers and each region server can have  multiple regions.The data is stored in the regions and when the region is full the data is flowed to the other regions.The data is partitioned across the regions on the basis of the row key.The Region Servers are present on the Hadoop data node and it is not necessary that there are as many Hbase region server as there are HDFS nodes.

Actions Performed By HRegion Server :-

  1. Responsible for hosting and managing Regions.
  2. Splits the Regions automatically when the table grows.
  3. Manages the read and write operation.
  4. Communicates with the client directly.



HMaster Server :- Normally in a Hadoop ecosystem , the HMaster runs on the same node on which the Name Node runs.It is used for managing and monitoring  the Region Server.

Actions Performed By HMaster Server :- 

  1. Assigns the HRegion Server on startup and reassign the HRegion server during recovery and load   balancing.
  2.  It coordinates and manages the HRegion Servers. 
  3. Responsible for DDL operations like Creating Table ,column families and deleting tables.

Zookeeper :- Zookeeper is a distributed coordination service to maintain the server state in the cluster.

Actions Performed By Zookeeper :-

  1. Zookeeper acts like a coordinator inside the server cluster by communicating through the sessions.
  2. Every Region server and HMaster sends the heartbeat to the Zookeeper , notifying that the server is in active state.Once the heartbeat will get stopped then the zookeeper assumes that the server is no long available and starts the recovery process.
  3. Zookeeper manages the .META severs path which helps in client searching for any particular region within the region servers.

We will go through Read and Write in HBase in our next tutorial.



Further Reading :- https://hbase.apache.org/

Tuesday, May 1, 2018

HBase - Data Model





 

We have gone through the introduction of the HBase in our last tutorial.We need to understand how the data model of the HBase works. Hbase stores the data in the table and having the rows and columns.It looks similar to the relational databases  but it has some serious differences in the structure.We will go through the differences one by one.

Every row in the Hbase table is indexed by the Row Key and these row keys are sorted dynamically and are unique.While designing the schema , the creation of Row key is very important.For every row key, we can store unlimited number of columns in the table.The new columns can be even added during the run time and can be grouped into the column families.

The columns are stored in the column families that creates a clear separation inside the table . In the relational database, the separation is created by the column .The designing of column families are paramount during the schema creation as they will impact the performance of the table.We should note that once the Column family is created during the table creation , it cannot be change afterwards.

The data in the column family can be sparsely populated and it is not necessary that all the column must contain the data in a particular column family.We can see the data in the form of rows and columns. In fact, the cells are stored as the individual entity with all the required information.

In a physical storage the cells of one family are stored in one storefile and the other column family are stored in another store file.The below table shows the column of the column family 1 with all the related information of the cell.
Similarly , the cell of the Column Family 2 are stored in the another storefile


.  
In addition, multiple versions of the same cell are stored as separate,consecutive cells,adding the required timestamp of when the cell was stored. The cells are sorted in descending order by that timestamp so that a reader of the data will see the newest value first.

Timestamp is always written alongside the row and it is the perfect identifier for the each version of a value.It signifies the time when the data is written into the server.

Few things we should note about the data storage in Hbase :-
  • Data once written cannot be changed but we can keep the latest version of the same data
  • We can configure the maximum number of version  that can be store for a particular value.
  • Oldest version of the value can be deleted by reaching the maximum number of the version.

Delta Lake - Time Travel

  Time Travel allows you to query, restore, or compare data from a previous version of a Delta table. Delta Lake automatically keeps tra...