Apache Hadoop YARN – NodeManager
The NodeManager (NM) is YARN’s per-node agent, and takes care of the individual compute nodes in a Hadoop cluster. This includes keeping up-to date with the ResourceManager (RM), overseeing containers’ life-cycle management; monitoring resource usage (memory, CPU) of individual containers, tracking node-health, log’s management and auxiliary services which may be exploited by different YARN applications.
NodeManager Components
- NodeStatusUpdater
On startup, this component registers with the RM and sends information about the resources available on the nodes. Subsequent NM-RM communication is to provide updates on container statuses – new containers running on the node, completed containers, etc.
In addition the RM may signal the NodeStatusUpdater to potentially kill already running containers.
- ContainerManager
This is the core of the NodeManager. It is composed of the following sub-components, each of which performs a subset of the functionality that is needed to manage containers running on the node.
- RPC server: ContainerManager accepts requests from Application Masters (AMs) to start new containers, or to stop running ones. It works with ContainerTokenSecretManager (described below) to authorize all requests. All the operations performed on containers running on this node are written to an audit-log which can be post-processed by security tools.
- ResourceLocalizationService: Responsible for securely downloading and organizing various file resources needed by containers. It tries its best to distribute the files across all the available disks. It also enforces access control restrictions of the downloaded files and puts appropriate usage limits on them.
- ContainersLauncher: Maintains a pool of threads to prepare and launch containers as quickly as possible. Also cleans up the containers’ processes when such a request is sent by the RM or the ApplicationMasters (AMs).
- AuxServices: The NM provides a framework for extending its functionality by configuring auxiliary services. This allows per-node custom services that specific frameworks may require, and still sandbox them from the rest of the NM. These services have to be configured before NM starts. Auxiliary services are notified when an application’s first container starts on the node, and when the application is considered to be complete.
- ContainersMonitor: After a container is launched, this component starts observing its resource utilization while the container is running. To enforce isolation and fair sharing of resources like memory, each container is allocated some amount of such a resource by the RM. The ContainersMonitor monitors each container’s usage continuously and if a container exceeds its allocation, it signals the container to be killed. This is done to prevent any runaway container from adversely affecting other well-behaved containers running on the same node.
- LogHandler: A pluggable component with the option of either keeping the containers’ logs on the local disks or zipping them together and uploading them onto a file-system.
- ContainerExecutor
Interacts with the underlying operating system to securely place files and directories needed by containers and subsequently to launch and clean up processes corresponding to containers in a secure manner.
- NodeHealthCheckerService
Provides functionality of checking the health of the node by running a configured script frequently. It also monitors the health of the disks specifically by creating temporary files on the disks every so often. Any changes in the health of the system are notified to NodeStatusUpdater (described above) which in turn passes on the information to the RM.
- Security
- ApplicationACLsManagerNM needs to gate the user facing APIs like container-logs’ display on the web-UI to be accessible only to authorized users. This component maintains the ACLs lists per application and enforces them whenever such a request is received.
- ContainerTokenSecretManager: verifies various incoming requests to ensure that all the incoming operations are indeed properly authorized by the RM.
- WebServer
Exposes the list of applications, containers running on the node at a given point of time, node-health related information and the logs produced by the containers.
Spotlight on Key Functionality
- Container Launch
To facilitate container launch, the NM expects to receive detailed information about a container’s runtime as part of the container-specifications. This includes the container’s command line, environment variables, a list of (file) resources required by the container and any security tokens.
On receiving a container-launch request – the NM first verifies this request, if security is enabled, to authorize the user, correct resources assignment, etc. The NM then performs the following set of steps to launch the container.
- A local copy of all the specified resources is created (Distributed Cache).
- Isolated work directories are created for the container, and the local resources are made available in these directories.
- The launch environment and command line is used to start the actual container.
- Log Aggregation
Handling user-logs has been one of the big pain-points for Hadoop installations in the past. Instead of truncating user-logs, and leaving them on individual nodes like the TaskTracker, the NM addresses the logs’ management issue by providing the option to move these logs securely onto a file-system (FS), for e.g. HDFS, after the application completes.
Logs for all the containers belonging to a single Application and that ran on this NM are aggregated and written out to a single (possibly compressed) log file at a configured location in the FS. Users have access to these logs via YARN command line tools, the web-UI or directly from the FS.
- How MapReduce shuffle takes advantage of NM’s Auxiliary-services
The Shuffle functionality required to run a MapReduce (MR) application is implemented as an Auxiliary Service. This service starts up a Netty Web Server, and knows how to handle MR specific shuffle requests from Reduce tasks. The MR AM specifies the service id for the shuffle service, along with security tokens that may be required. The NM provides the AM with the port on which the shuffle service is running which is passed onto the Reduce tasks.
Conclusion
In YARN, the NodeManager is primarily limited to managing abstract containers i.e. only processes corresponding to a container and not concerning itself with per-application state management like MapReduce tasks. It also does away with the notion of named slots like map and reduce slots. Because of this clear separation of responsibilities coupled with the modular architecture described above, NM can scale much more easily and its code is much more maintainable.
相关推荐
Apache Hadoop YARN: Moving beyond MapReduce and Batch Processing with Apache Hadoop 2 完整版哦,绝对清晰,不是扫描的mobi格式电子书,请使用电子书库calibre (http://calibre-ebook.com/download) 打开。
《Apache Hadoop YARN》,全名Apache Hadoop YARN: Moving beyond MapReduce and Batch Processing with Apache Hadoop 2 (Addison-Wesley Data & Analytics Series) 这本书是2014年3月31号出版的,是基于Hadoop 2...
Apache Hadoop YARN:Moving beyond MapReduce and Batch Processing with Apach 2 【yarn权威指南】
软件介绍: ...mobi格式的清晰版Apache Hadoop YARN,这个是高清版不是扫描版的,请使用calibre电子书阅读器进行阅读,具体效果可以查看上面的书籍截图。本书深入讲解hadoop2的原理,很详细值得一读。
Apache Hadoop YARN是Hadoop 2.0核心组件之一,它代表了Hadoop技术的重大进步,超越了原有的MapReduce和批处理的局限性。Hadoop YARN权威指南是一本专门介绍YARN架构及其功能的书籍。首先,我们需要了解Hadoop YARN...
**Apache Hadoop YARN 深入解析** Apache Hadoop 是一个开源的分布式计算框架,主要由两个核心组件构成:HDFS(Hadoop Distributed File System)和YARN(Yet Another Resource Negotiator)。本教程将深入探讨YARN...
Apache Hadoop TM YARN Moving beyond MapReduce and Batch Processing with Apache HadoopTM 2 全本,不是sample。
Maven坐标:org.apache.hadoop:hadoop-yarn-api:2.5.1; 标签:apache、hadoop、api、yarn、jar包、java、API文档、中文版; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 ...
### Apache Hadoop YARN:Yet Another Resource Negotiator #### 概述 Apache Hadoop YARN(Yet Another Resource Negotiator)是Hadoop生态系统中的一个关键组件,它为Hadoop提供了资源管理和作业调度的能力。...
Apache Hadoop YARN is the modern distributed operating system for big data applications. It morphed the Hadoop compute layer to be a common resource-management platform that can host a wide variety of...
Maven坐标:org.apache.hadoop:hadoop-yarn-client:2.6.5; 标签:apache、client、hadoop、yarn、jar包、java、中文文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 ...
从文件中提供的信息来看,董西成在其关于Hadoop YARN程序设计与应用案例的演讲中,涵盖了Hadoop YARN的定义、架构、API和开发步骤、应用类型、以及YARN API所涉及的通信协议和客户端库等核心知识点。以下是对这些...
利用Hadoop YARN ResourceManager 未授权访问getshell工具以及WORD说明
### Apache Hadoop YARN:超越MapReduce与批处理 #### 概述 Apache Hadoop YARN,即Yet Another Resource Negotiator,是Hadoop生态系统中的一个关键组件,它为Hadoop带来了资源管理和分布式应用运行的新机制。自...
Hadoop的YARN架构是Hadoop版本2.x引入的一个重要组件,它负责处理资源管理和作业调度,而核心的计算任务处理则交给了MapReduce、Tez、Spark等计算框架。YARN的出现是为了解决Hadoop早期版本中的可扩展性问题,它通过...
Maven坐标:org.apache.hadoop:hadoop-yarn-client:2.7.3; 标签:apache、hadoop、yarn、client、中英对照文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容...