Difference Between HDFS and HBase
What is HDFS (Hadoop Distributed File System):- HDFS allows you to store huge amounts of data in a distributed and redundant manner, which runs on commodity hardware.
Components of HDFS
NameNode: NameNode can be considered as a master of the system. It maintains the file system tree and the metadata for all the files and directories present in the system. Two files ‘Namespace image’ and the ‘edit log’ are used to store metadata information. Namenode has knowledge of all the data nodes containing data blocks for a given file, however, it does not store block locations persistently. This information is reconstructed every time from data nodes when the system starts.
DataNode: DataNodes are slaves which reside on each machine in a cluster and provide the actual storage. It is responsible for serving, read and write requests for the clients.
What is HBase (Hadoop’s database):- HBase is a NoSQL database that runs on top your Hadoop cluster.
Components of HBase:-
- Hbase master
- Region Server
HMaster: It is the Master server in HBase architecture. It is the monitoring agent to monitor all Region Server and also it is the responsibility of HMaster to be the interface for all the metadata changes. It runs on NameNode.
Regions Servers: When Region Server receives writes and read requests from the client, it assigns the request to a specific region, where actual column family resides. However, the client can directly contact with Region servers, there is no need of HMaster mandatory permission to the client regarding communication with Region Servers. The client requires HMaster help when operations related to metadata and schema changes are required.
Regions: Regions are the basic building elements of HBase cluster that consists of the distribution of tables and are comprised of Column families. It contains multiple stores, one for each column family. It consists of mainly two components, which are Memstore and Hfile.
ZooKeeper: In Hbase, Zookeeper is a centralized monitoring server which maintains configuration information and provides distributed synchronization. Distributed synchronization is to access the distributed applications running across the cluster with the responsibility of providing coordination services between nodes. If the client wants to communicate with regions, the server’s client has to approach ZooKeeper first.
HBase Architecture:- HBase is a part of Hadoop’s Ecosystem.
Head to Head Comparison Between HDFS vs HBase (Infographics)
Below is the Top 14 Comparision Between HDFS vs HBase
Key Differences between HDFS vs HBase
Below is the difference between HDFS and HBase are as follows
- HDFS is a distributed file system that is well suited for the storage of large files. But HBase, on the other hand, is built on top of HDFS and provides fast record lookups (and updates) for large tables.
- HDFS has based on GFS file system. But HBase is distributed – uses HDFS for storage, column – Oriented, Multi-Dimensional (Versions) and Storage System
- HDFS uses HIVE as one of its component for the quire language which is HIVE Query Language(HQL), but Hbase is NOT a SQL Database that means:- No Joins, no query engine, no datatypes, no (damn) SQL, No Schema and no DBA needed.
- As HDFS is a distributed storage unit hence have no specific language other than the commands used like the UNIX flavor like for example:- Hadoop dfs -mkdir /foodir
- hadoop dfs -cat /foodir/myfile.txt
- hadoop dfs -rm /foodir/myfile.txt
But on the other hand Hbase has its own interface in the form of Hbase Shell like for example:-
- hbase(main):003:0> create ‘test’, ‘cf’
0 row(s) in 1.2200 seconds
- hbase(main):004:0> put ‘test’, ‘row1’, ‘cf:a’, ‘value1’
0 row(s) in 0.0560 seconds
- hbase(main):005:0> put ‘test’, ‘row2’, ‘cf:b’, ‘value2’
0 row(s) in 0.0370 seconds
- hbase(main):006:0> put ‘test’, ‘row3’, ‘cf:c’, ‘value3’
0 row(s) in 0.0450 seconds
- hbase(main):007:0> scan ‘test’
row1 column=cf:a, timestamp=1288380727188, value=value1
row2 column=cf:b, timestamp=1288380738440, value=value2
row3 column=cf:c, timestamp=1288380747365, value=value3
3 row(s) in 0.0590 seconds
HDFS vs HBase Comparision Table
|Basis for Comparison||HDFS||HBase|
|Why WE Need them||Need to process huge datasets on large clusters of computers||HBase is a distributed column-oriented data store built on top of HDFS|
|Nodes fail every day||a) Failure is expected, rather than exceptional
b) The number of nodes in a cluster is not constant
|HBase is an Apache open source project whose goal is to provide storage for the Hadoop Distributed Computing|
|Write Pattern||Append Only||Random write, bulk incremental|
|Read Pattern||Full table scan, partition table scan||Random read, small range scan or table scan|
|W/R Pattern||HDFS is ideally suited for write-once and read-many times use cases||HBase is ideally suited for random write and read of data that is stored in HDFS.|
|Hive(SQL) Performance||Relatively very good||4-5 times slower|
|Structured Storage||Do it yourself or TSV or Sequence File||Sparse column family data model|
|Maximum Data Size||Typically can stores near about 30 PB||Approximately around 1 PB|
|Dynamic Changes||HDFS has a rigid architecture that does not allow changes. It doesn’t facilitate dynamic storage.||HBase allows for dynamic changes and can be utilized for standalone applications.|
|Data Distribution||Data is stored in a distributed manner across the nodes in a cluster. Data is divided into blocks and is then stored over nodes present in HDFS cluster.||Tables are distributed on the cluster via regions, and regions are automatically split and re-distributed as your data grows|
|Data Storage||All the data is stored in the form of small files and all files are of a typical size of 64 MB (which is 128 MB in the newer version)||All the data is being stored in the form of tables, rows, and columns|
|Data Modeling||In HDFS we use the Map Reduce technique which divides the files into the Key – Value pairs||HBase is based on Google’s Bigtable model which uses Key-Value pairs as well|
|Operations||It has high latency operations||It has low latency operations|
|Accessibility||It is primarily accessed through MR (Map Reduce) jobs||It can be accessed through shell commands, client API in Java, REST, Avro or Thrift|
Conclusion – HDFS vs HBase
In overall conclusion, both HDFS and HBase has wonderful technologies in their own. They both HDFS and HBase were created to store the Big Data and to make an easy in accessing and computing them. They both HDFS and HBase go side by side as one HDFS stores the data the other one HBase puts a schema on the data on how to store and retrieve it later for the usage of the client.
Hbase is one of NoSql column-oriented distributed database available in apache foundation. HBase gives more performance for retrieving fewer records rather than Hadoop or Hive. It’s very easy to search for given any input value because it supports indexing, transactions, and updating.
We can perform online real-time analytics using Hbase integrated with the Hadoop ecosystem. It has an automatic and configurable sharding for datasets or tables and provides restful API’s to perform the MapReduce jobs.
This has been a guide to HDFS vs HBase, their Meaning, Head to Head Comparison, Key Differences, Comparision Table, and Conclusion. this article has all the useful difference between HDFS and HBase.You may also look at the following articles to learn more –