YARN--Core components

来源:互联网 发布:php 判断文件类型 编辑:程序博客网 时间:2024/06/03 12:26

组件关系图(from hadoop yarn home):
这里写图片描述

Container

At the fundamental level, a container is a collection of physical resources such as RAM, CPU cores, and disks on a single node. There can be multiple containers on a single node (or a single large one). Every node in the system is considered to be composed of multiple containers of minimum size of memory (e.g., 512 MB or 1 GB) and CPU. The ApplicationMaster can request any container so as to occupy a multiple of the minimum size.

A container thus represents a resource (memory, CPU) on a single node in a given cluster. A container is supervised by the NodeManager and scheduled by the ResourceManager.

Each application starts out as an ApplicationMaster, which is itself a container (often referred to as container 0). Once started, the ApplicationMaster must negotiate with the ResourceManager for more containers. Container requests (and releases) can take place in a dynamic fashion at run time. For instance, a MapReduce job may request a certain amount of mapper containers; as they finish their tasks, it may release them and request more reducer containers to be started.

一个容器是在一个节点上的一些物理资源的额集合(CPU, 内存, 网络, 磁盘等), 比如500MB内存为一个容器, 那么如果这个节点有8G内存,则可以有16个容器.

因此,一个集群中的一个节点中的一个容器代表了一个资源, 这个资源的所有者和调度者是ResourceManager(资源调度器), 而在这个节点上的NodeManager(节点管理器)是辅助资源管理器进行管理的.

在YARN, 当一个应用开始运行时, 就伴随着一个ApplicationMaster产生, 同时自身也是一个Container(视作container 0).他的主要职责是负责为应用程序和ResourceManager协调资源–当需要更多时申请, 当需要释放时发出释放请求.

NodeManager

The NodeManager is YARN’s per-node “worker” agent, taking care of the individual compute nodes in a Hadoop cluster. Its duties include keeping up-to-date with the ResourceManager, overseeing application containers’ life-cycle management, monitoring resource usage (memory, CPU) of individual containers, tracking node health, log management, and auxiliary services that may be exploited by different YARN applications.50 Chapter 4 Functional Overview of YARN Components On start-up, the NodeManager registers with the ResourceManager; it then sends heartbeats with its status and waits for instructions. Its primary goal is to manage application containers assigned to it by the ResourceManager.

YARN containers are described by a container launch context (CLC). This record includes a map of environment variables, dependencies stored in remotely accessible storage, security tokens, payloads for NodeManager services, and the command necessary to create the process. After validating the authenticity of the container lease, the NodeManager configures the environment for the container, including initializing its monitoring subsystem with the resource constraints’ specified application. The NodeManager also kills containers as directed by the ResourceManager.

集群中每一个节点都有一个NodeManger, 他的工作是帮助ResourceManager处理资源事务, 换言之, 他的主要工作是:接受并执行上级指令, 监督,安排container运行, 向上级汇报工作.使用了心跳机制与ResourceManager保持沟通.

集群中一个节点上的一个Container被一个CLC(Container Launch Context)描述.

ApplicationMaster

The ApplicationMaster is the process that coordinates an application’s execution in the cluster. Each application has its own unique ApplicationMaster, which is tasked with negotiating resources (containers) from the ResourceManager and working with the NodeManager(s) to execute and monitor the tasks. In the YARN design, MapReduce is just one application framework; this design permits building and deploying distributed applications using other frameworks. For example, YARN ships with a Distributed-Shell application that allows a shell script to be run on multiple nodes on the YARN cluster.

Once the ApplicationMaster is started (as a container), it will periodically send heartbeats to the ResourceManager to affirm its health and to update the record of its resource demands. After building a model of its requirements, the ApplicationMaster encodes its preferences and constraints in a heartbeat message to the ResourceManager. In response to subsequent heartbeats, the ApplicationMaster will receive a lease on containers bound to an allocation of resources at a particular node in the cluster. Depending on the containers it receives from the ResourceManager, the ApplicationMaster may update its execution plan to accommodate the excess or lack of resources. Container allocation/deallocation can take place in a dynamic fashion as the application progresses.

原创粉丝点击