Chapter N2 HDFS The Hadoop Distributed File System - Matrix
Chapter N2 HDFS The Hadoop Distributed File System - Matrix
Deployment Architecture
Name Node
Deployment Architecture
Name Node
■ What is Hadoop?
■ What is Hadoop?
– Apache Hadoop is an open source software framework used to develop data processing
– Applications built using HADOOP are run on large data sets distributed across clusters of
commodity computers.
■ Commodity computers are cheap and widely available. These are mainly useful for achieving greater
■ Hadoop History
Introduction
■ Core of Hadoop
HDFS
Storage Part
( Hadoop Distributed File System)
Deployment Architecture
Name Node
computation nodes.
■ The Hadoop Distributed File System (HDFS) is the underlying file system of a Hadoop cluster.
■ It provides scalable, fault-tolerant, rack-aware data storage designed to be deployed on commodity hardware.
■ HDFS is:
– rack-aware ( In Rack Awareness, NameNode chooses the DataNode which is closer to the same rack or nearby rack)
Deployment Architecture
Name Node
■
OUTLINE
Introduction
Deployment Architecture
Name Node
■
Name Node
– The file metadata for these blocks, which include the file name, file permissions, IDs, locations, and the
– FsImage is a file stored on the OS filesystem that contains the complete directory structure (namespace) of
the HDFS with details about the location of the data on the Data Blocks and which blocks are stored on
which node
– EditLogs is a transaction log that recorde the changes in the HDFS file system or any action performed on the HDFS
cluster such as addtion of a new block, replication, deletion etc., It records the changes since the last FsImage was
created, it then merges the changes into the FsImage file to create a new FsImage fil
Name Node
■ Should a NameNode fail, HDFS would not be able to locate any of the data sets distributed throughout the
DataNodes.
– This makes the NameNode the single point of failure for the entire cluster.
– Secondary Namenode's whole purpose is to have a checkpoint in HDFS. Its just a helper node for
Deployment Architecture
Name Node
■ Secondary NameNode
– The Secondary NameNode served as the primary backup solution in early Hadoop versions. The
Secondary NameNode, every so often, downloads the current fsimage instance and edit logs from
the NameNode and merges them. The edited fsimage can then be retrieved and restored in the
primary NameNode.
– The failover is not an automated process as an administrator would need to recover the data from
■ Standby NameNode
– The High Availability feature was introduced in Hadoop 2.0 and subsequent versions to avoid any
downtime in case of the NameNode failure. This feature allows you to maintain two NameNodes
unavailable. The Standby NameNode additionally carries out the check-pointing process. Due to this
property, the Secondary and Standby NameNode are not compatible. A Hadoop cluster can maintain
■ Data NameNode
– Each DataNode in a cluster uses a background process to store the individual blocks of data on
slave servers.
– By default, HDFS stores three copies of every data block on separate DataNodes. The NameNode
uses a rack-aware placement policy. This means that the DataNodes that contain the data block
replicas cannot all be located on the same server rack.
– A DataNode communicates and accepts instructions from the NameNode roughly twenty times a
minute. Also, it reports the status and health of the data blocks located on that node once an hour.
Based on the provided information, the NameNode can request the DataNode to create additional
replicas, remove them, or decrease the number of data blocks present on the node
Data Node and Checkpoint Node (Secondary Name Node)
■ One of the main objectives of a distributed storage system like HDFS is to maintain high availability and replication.
Therefore, data blocks need to be distributed not only on different DataNodes but on nodes located on different
server racks.
■ This ensures that the failure of an entire rack does not terminate all data replicas. The HDFS NameNode maintains a
default rack-aware replica placement policy:
■ The first data block replica is placed on the same node as the client.
■ The third replica is placed in a separate DataNode on the same rack as the second replica.
■ Any additional replicas are stored on random DataNodes throughout the cluster.
Data Node and Checkpoint Node (Secondary Name Node)
■ This rack placement policy maintains only one replica per node and sets a limit of two replicas per server
rack.
Rack failures are much less frequent than node failures. HDFS ensures high reliability by always storing at least one data
block replica in a DataNode on a different rack
OUTLINE
Introduction
Deployment Architecture
Name Node
■ Read Operation
file. Please note that these addresses are of first few blocks of a
file.
■ Read Operation
block of a file.
HDFS Data Flows (Read/Write)
■ Read Operation
close() method.
HDFS Data Flows (Read/Write)
■ Write Operation
1- A client initiates write operation by calling 'create()' method
of DistributedFileSystem object which creates a new file -
Step no. 1 in the above diagram.
2- DistributedFileSystem object connects to the NameNode
using RPC call and initiates new file creation. However, this
file creates operation does not associate any blocks with the
file. It is the responsibility of NameNode to verify that the file
(which is being created) does not exist already and a client
has correct permissions to create a new file. If a file already
exists or client does not have sufficient permission to create
a new file, then IOException is thrown to the client.
Otherwise, the operation succeeds and a new record for the
file is created by the NameNode.
HDFS Data Flows (Read/Write)
■ Write Operation
3- Once a new record in NameNode is created, an object of
type FSDataOutputStream is returned to the client. A client
uses it to write data into the HDFS. Data write method is
invoked (step 3 in the diagram).
4- FSDataOutputStream contains DFSOutputStream object
which looks after communication with DataNodes and
NameNode. While the client continues writing
data, DFSOutputStream continues creating packets with this
data. These packets are enqueued into a queue which is
called as DataQueue.
HDFS Data Flows (Read/Write)
■ Write Operation
pipeline.
HDFS Data Flows (Read/Write)
■ Write Operation
the pipeline.
■ Write Operation
10- Once acknowledgment for a packet in the queue is
received from all DataNodes in the pipeline, it is removed
from the 'Ack Queue'. In the event of any DataNode failure,
packets from this queue are used to reinitiate the operation.
11- After a client is done with the writing data, it calls a
close() method (Step 9 in the diagram) Call to close(), results
into flushing remaining data packets to the pipeline followed
by waiting for acknowledgment.
12- Once a final acknowledgment is received, NameNode is
contacted to tell it that the file write operation is complete.
HDFS Commands
1. https://www.erpublication.org/published_paper/IJETR042630.pdf
2. https://www.pearsonitcertification.com/articles/article.aspx?p=2427073&seqNum=2
3. https://intellipaat.com/blog/7-big-data-examples-application-of-big-data-in-real-life/
Thank you