Large volumes of data,
stored and processed across the whole cluster.
Apache Hadoop stores and processes large volumes of data on a cluster of computers: HDFS stores, YARN allocates resources, MapReduce processes in parallel, and Hadoop Common supports all three. Follow a job from the file written in blocks to the result back in HDFS.
Apache Hadoop is a framework for the distributed processing of large data sets across clusters of computers, using simple programming models.
It scales from a single server to thousands of machines, each offering local computation and storage.
Four modules
Store, allocate, and process
HDFS stores files in blocks, YARN manages the cluster resources and schedules jobs, MapReduce processes in parallel, and Hadoop Common supports the other modules.
Local data
Computation moves to the data
In general, the machines that store the data are the same ones that process it, and tasks are scheduled where the data already is: this is data locality.
Simple model
Map and reduce, the framework does the rest
In a MapReduce job, the application specifies the input, the output, and the map and reduce functions. The framework schedules the tasks, monitors their execution, and re-executes the ones that fail.
On this page
- Watch a job go through Hadoop
- Architecture
- The four modules
- Computation moves to the data
- Why Hadoop
- In the TDP editions
Watch a job go through Hadoop
A file written to HDFS and processed by a MapReduce job on YARN. Press Play or step through. Underlined names lead to the Glossary.
1 The file becomes blocks
The client writes the input file to HDFS. The file is split into blocks, and the NameNode records the file name and decides on which DataNodes each block is stored. The client sends the data to the first DataNode, which passes it on to the next: the blocks are replicated for fault tolerance.
In the Glossary: NameNode · DataNode · Block (HDFS)
- The file becomes blocks. The client writes the input file to HDFS. The file is split into blocks, and the NameNode records the file name and decides on which DataNodes each block is stored. The client sends the data to the first DataNode, which passes it on to the next: the blocks are replicated for fault tolerance.
- The job reaches the ResourceManager. The job client submits the job and its configuration to the ResourceManager: where the input and the output are, and which are the map and reduce functions.
- An ApplicationMaster for the job. The ResourceManager accepts the job and negotiates the first container on a NodeManager, where the job's ApplicationMaster runs. In MapReduce, the ApplicationMaster is the MRAppMaster.
- The ApplicationMaster requests resources. The ApplicationMaster negotiates with the ResourceManager the containers the tasks need and works with the NodeManagers to execute and monitor them.
- Map tasks run where the blocks are. The input is split into independent chunks, processed in parallel by the map tasks. In general, the number of map tasks follows the number of blocks in the input. Because the machines that store the data are the same ones that process it, tasks are scheduled where the blocks already are, which reduces network traffic.
- Map outputs go to reduce. The framework sorts the outputs of the map tasks, which become the input of the reduce tasks.
- The result goes back to HDFS. Like the input, the job output is stored in a file system: the reduce tasks write the result to HDFS, again in blocks on the DataNodes.
- The job client follows it to the end. During the job, the ResourceManager provides the job client with status and diagnostic information. The framework monitors the tasks and re-executes the ones that fail.
Architecture
The four modules in layers and the cluster they run on: master machines that coordinate, worker machines that store and process.
What the figure shows:
- MapReduce is the parallel processing module, as a YARN application: map tasks, sorting, and reduce tasks. Configuration in
mapred-site.xml. - HDFS is the distributed storage, with the NameNode and DataNodes. Configuration in
hdfs-site.xml. - YARN handles resources and scheduling, with the ResourceManager and NodeManagers. Configuration in
yarn-site.xml. - Hadoop Common brings together the common utilities that support the other modules. Configuration in
core-site.xml. - The client writes files and submits jobs: it talks to the NameNode, for files, and to the ResourceManager, for jobs.
- The master machines: in general, one machine in the cluster runs the HDFS NameNode, which stores the file names and the block map, and another runs the YARN ResourceManager, which arbitrates resources among the applications.
- The worker machines are the remaining ones, and each runs a DataNode, which stores the blocks, and a NodeManager, which runs the containers with the ApplicationMaster and the map and reduce tasks of the jobs.
- Local reads: a task can read the blocks from the very machine it runs on.
The four modules
One project, four modules. Each has its own configuration file on the cluster.
Foundation
Hadoop Common
The common utilities that support the other modules. Configured in core-site.xml, which sets, among others, the default file system.
Storage
HDFS
A distributed file system with high-throughput access to application data. Configured in hdfs-site.xml.
Resources
YARN
A framework for job scheduling and cluster resource management. Configured in yarn-site.xml.
Processing
MapReduce
A YARN-based system for the parallel processing of large data sets. Configured in mapred-site.xml.
Computation moves to the data
Two ways of bringing a program and a large volume of data together.
Far from the data
The data travels to the program
A computation executed far from the data it needs is much less efficient, especially when the data set is huge.
Close to the data
The program goes to the blocks
When executed close to the data, the computation reduces network congestion and increases the cluster's throughput. HDFS provides interfaces for applications to move closer to the data.
In Hadoop, this is the usual arrangement: the storage and processing machines are the same, with the DataNode and the NodeManager side by side on each worker machine.
This way, MapReduce schedules the tasks on the machines where the data already is, and the cluster reaches a very high aggregate throughput. See data locality.
Why Hadoop
Scale
From one server to thousands of machines
The cluster grows with more machines, and each one brings local computation and storage.
Availability
Failures handled by the software
Rather than relying on hardware, Hadoop itself detects and handles failures at the application layer, and delivers a highly available service on top of machines that may be prone to failures.
Commodity hardware
Low-cost machines
HDFS and MapReduce were designed for clusters of commodity hardware, where the failure of some component is the norm rather than the exception.
Throughput
Large files, streaming reads
HDFS is tuned for large files and for batch processing, with an emphasis on data access throughput.
Ecosystem
A base for other projects
Apache projects such as Hive, HBase, Spark, Tez, and Ozone connect to Hadoop, and Ambari provisions, manages, and monitors Hadoop clusters.
Languages
Beyond Java
The framework is written in Java, and MapReduce applications can also be written in other languages, through Hadoop Streaming and Hadoop Pipes.
HDFS was born as infrastructure for Apache Nutch, a web search engine project. Today, Apache Hadoop is open-source software, developed by the Apache Software Foundation.
In the TDP editions
| Edition | Version | Documentation |
|---|---|---|
| TDP Datacenter | 3.3.6 | TDP Datacenter components |
In TDP Datacenter
In TDP Datacenter, the Hadoop modules arrive as three stack services, installed and managed by Ambari: HDFS, YARN, and MAPREDUCE2.
NAMENODE and SECONDARY_NAMENODE (master), DATANODE (slave), and HDFS_CLIENT (client), among other components. See HDFS.
RESOURCEMANAGER (master), NODEMANAGER (slave), and YARN_CLIENT (client), besides the Timeline Service components. See YARN.
HISTORYSERVER (master) and MAPREDUCE2_CLIENT (client). The execution framework for MapReduce jobs is configurable in mapreduce.framework.name, in the mapred-site configuration. See MapReduce.
The core-site configuration, from Hadoop Common, belongs to the HDFS service: in it, the default file system is configurable in fs.defaultFS, as is the topology script that locates the machines in racks, in net.topology.script.file.name.
DataNode and NodeManager are components of the slave category and sit side by side on the worker machines. See Data and processing on the same machines.
The three services depend on one another and on ZooKeeper: HDFS requires YARN; YARN requires HDFS and MapReduce2; MapReduce2 requires YARN.
HDFS and YARN are among the required services of Hive, Spark, Flink, JupyterLab, and Zeppelin; HDFS, of HBase, Druid, Solr, Sqoop, and Ranger KMS; YARN, of Tez.
Cluster authentication is configurable in hadoop.security.authentication, with simple or kerberos, and the Ranger plugins for HDFS and YARN can be enabled in ranger-hdfs-plugin-enabled and ranger-yarn-plugin-enabled. See Security in TDP Datacenter.
Next steps
TDP Datacenter
Data and processing
HDFS and YARN on the same machines of the cluster managed by Ambari.
Sources
Apache Hadoop - HDFS Architecture
Apache Hadoop - YARN Architecture