Skip to main content

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​

A file written to HDFS and processed by a MapReduce job on YARN. Press Play or step through. Underlined names lead to the Glossary.

ClientWho writes and submits
HDFS clientWrites the input file
Job clientSubmits the MapReduce job
Master machinesWho coordinates
NameNodeNames and block map
ResourceManagerArbitrates resources
Worker machineStores and processes
DataNodeFile blocks
NodeManagerThis machine's containers
ApplicationMasterThe job's MRAppMaster
Worker machineStores and processes
DataNodeFile blocks
NodeManagerThis machine's containers
Step 1 of 8

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.

  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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. Map outputs go to reduce. The framework sorts the outputs of the map tasks, which become the input of the reduce tasks.
  7. 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.
  8. 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.
Figure 1 - A job in Hadoop. HDFS stores the input and the output in blocks; YARN provides the resources; the tasks run on the machines where the blocks are.

Architecture​

The four modules in layers and the cluster they run on: master machines that coordinate, worker machines that store and process.

Apache Hadoop architecture: the four modules and the cluster with master machines and worker machinesOn the left, the four Apache Hadoop modules in layers: Hadoop Common at the base, with the common utilities and the core-site.xml file; HDFS, distributed storage with the NameNode and DataNodes and the hdfs-site.xml file; YARN, resources and scheduling with the ResourceManager and NodeManagers and the yarn-site.xml file; and, at the top, MapReduce, parallel processing as a YARN application, with the mapred-site.xml file. On the right, the cluster: the client talks to the NameNode, for files, and to the ResourceManager, for jobs. The master machines run the NameNode, which stores the file names and the block map, and the ResourceManager, which arbitrates resources among applications. Each worker machine runs a DataNode, which stores blocks, and a NodeManager, which runs containers with the ApplicationMaster and the map and reduce tasks; the tasks read the blocks on their own machine.Apache Hadoop: four modulesMapReduceParallel processing, as a YARN applicationMap tasks, sort, and reduce tasksmapred-site.xmlHDFSDistributed storageNameNodeDataNodeshdfs-site.xmlYARNResources and schedulingResourceManagerNodeManagersyarn-site.xmlHadoop CommonCommon utilities that support the other modulescore-site.xmlClientWrites files and submits jobsClusterMaster machinesNameNodeFile names and block mapResourceManagerArbitrates resources among applicationsWorker machineDataNodeBlockBlockLocal readNodeManagerContainerApplicationMasterContainerMap taskWorker machineDataNodeBlockBlockLocal readNodeManagerContainerMap taskContainerReduce taskWorker machineDataNodeBlockBlockLocal readNodeManagerContainerMap taskContainerMap taskHDFS: the NameNode and DataNodesYARN: the ResourceManager and NodeManagersLocality: the task reads the blocks on its own machine
Figure 2 - Apache Hadoop architecture: the four modules, with the configuration file of each one, and the cluster of master and worker machines. Underlined terms lead to the Glossary.

What the figure shows:

  1. MapReduce is the parallel processing module, as a YARN application: map tasks, sorting, and reduce tasks. Configuration in mapred-site.xml.
  2. HDFS is the distributed storage, with the NameNode and DataNodes. Configuration in hdfs-site.xml.
  3. YARN handles resources and scheduling, with the ResourceManager and NodeManagers. Configuration in yarn-site.xml.
  4. Hadoop Common brings together the common utilities that support the other modules. Configuration in core-site.xml.
  5. The client writes files and submits jobs: it talks to the NameNode, for files, and to the ResourceManager, for jobs.
  6. 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.
  7. 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.
  8. 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.

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.

Where it comes from

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​

Available in the TDP editions
EditionVersionDocumentation
TDP Datacenter3.3.6TDP 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.

HDFS

NAMENODE and SECONDARY_NAMENODE (master), DATANODE (slave), and HDFS_CLIENT (client), among other components. See HDFS.

YARN

RESOURCEMANAGER (master), NODEMANAGER (slave), and YARN_CLIENT (client), besides the Timeline Service components. See YARN.

MapReduce2

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.

Common configuration

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.

Worker machines

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.

Joint installation

The three services depend on one another and on ZooKeeper: HDFS requires YARN; YARN requires HDFS and MapReduce2; MapReduce2 requires YARN.

What depends on Hadoop

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.

Security

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​

Sources​

Apache Hadoop

Apache Hadoop - HDFS Architecture

Apache Hadoop - YARN Architecture

Apache Hadoop - MapReduce Tutorial

Apache Hadoop - Cluster Setup