zoukankan      html  css  js  c++  java
  • Hadoop- 分布式资源管理YARN架构讲解

    YARN是分布式资源管理,每一台机器都要去管理该台计算机的资源,Yarn负责为MapReduce程序分配运算硬件资源。每一台机器的管理者叫 NodeManager,整个集群的管理者管理着整个集群的NodeManager,叫 ResourceManager。资源调度和资源隔离是YARN作为一个资源管理系统最重要和最基础的两个功能。资源调度由 ResourceManager 完成,而资源隔离由各个DataNode实现。

    YARN架构图,来源于官网:http://hadoop.apache.org/docs/r2.6.5/hadoop-yarn/hadoop-yarn-site/YARN.html

    当客户端提交任务给 ResourceManager, YARN会为每个在YARN上面运行的任务生成一个应用管理者(Application Mater),Application Master根据MapReduce所需要的资源向ResourceManager申请资源,该任务在ResourceManager分配好的资源容器(container)里面运行,该资源容器在NodeManager上。

    ResourceManager:处理客户端请求;启动/监控ApplicationMaster;监控NodeManager;资源分配与调度

    ApplicationMaster:数据切分;为应用程序申请资源,并分配给内部任务;任务监控与容错

    NodeManager:单个节点上的资源管理;处理来自ResourceManager的命令;处理来自ApplicationMaster的命令

    Container:对任务运行环境的抽象,封装了CPU、内存等多维资源以及环境变量、启动命令等任务运行相关的信息

    MapReduce如何在YARN上运行

    1,客户端(client)向ResourceManager提交一个应用程序任务。ResourceManager主要有两个组件:Scheduler(资源调度)和ApplicationsManager(应用管理)

    2,ResourManager接收到client提交的任务(Task)后,需要为该应用创建一个应用管理者(ApplicationMaster)。ApplicationsManager负责接受作业(Task)提交,协商第一个容器来执行特定于应用程序的ApplicationMaster,并提供重新启动ApplicationMaster容器的服务。ResouManager找到一台NodeManager节点,创建一个ApplicationMaster

    3,ApplicationMaster 对任务进行划分,确定需要多少资源,向 ApplicationsManager 注册已经生成 ApplicationMaster,并为任务申请资源。

    4,Scheduler(资源调度)负责根据容量,队列等的熟悉限制向各种运行的应用程序分配资源。调度程序是纯调度器,它不执行监视或跟踪应用程序的状态。ResourcManager向ApplicationMaster 返回的资源就是用Container表示的.

    5,ApplicationMaster 取得任务需要的资源信息后,向分配到的资源相关NodeManager分配任务。

    6,各NodeManager接受到 ApplicationMaster 的命令后,NodeManager在他们的容器中启动Map Task / Reduce Task

    7,每个Task都要向ApplicationMaster 报告进度状况,每个应用程序ApplicationMaster有责任从调度程序协商适当的资源容器,跟踪其状态并监视进度。

    8,所有任务完成后,ApplicationMaster 向  ApplicationsManager 汇报完成任务。

    客户端(client)可以通过页面监控任务进度(8088端口)

    yarn的配置文件yarn-site.xml上需要根据你的实际情况更改属性参数,yarn的一些默认值如

    name value description
    yarn.nodemanager.resource.memory-mb 8192 Amount of physical memory, in MB, that can be allocated for containers.
    yarn.nodemanager.pmem-check-enabled true Whether physical memory limits will be enforced for containers.
    yarn.nodemanager.vmem-check-enabled true Whether virtual memory limits will be enforced for containers.
    yarn.nodemanager.vmem-pmem-ratio 2.1 Ratio between virtual memory to physical memory when setting memory limits for containers. Container allocations are expressed in terms of physical memory, and virtual memory usage is allowed to exceed this allocation by this ratio.
    yarn.nodemanager.resource.cpu-vcores 8 Number of vcores that can be allocated for containers. This is used by the RM scheduler when allocating resources for containers. This is not used to limit the number of physical cores used by YARN containers.

     如果你的机器的性能没有默认的大的话请根据实际的修改掉value值,就是节点资源不够的话需要适当减小这个值,而yarn不会只能的探测节点的物理内存总量。

    拓展:yarn上面的日志聚集功能配置使用:

    <property>
                    <name>yarn.log-aggregation-enable</name>
                    <value>true</value>
    </property>
    <property>
                    <name>yarn.log-aggregation.retain-check-interval-seconds</name>
                    <value>640800</value>
    </property>

    历史服务器historyserver

    查看已经运行完成的MapReduce作业记录,比如用了多少个Map,用了多少个Reduce,作业提交时间,作业启动时间,作业完成时间等信息。

    启动命令:sbin/mr-jobhistory-daemon.sh start historyserver.

    Web Ui: http://hostname:19888/

    停止:sbin/mr-jobhistory-daemon.sh stop historyserver.

  • 相关阅读:
    Servlet深层知识
    HTTP协议
    Web开发中的主要概念
    Schema约束
    连接池基础
    Mysql基础3
    JDBC常用接口详解
    Mysql基础2
    Mysql基础1
    使用12c的DBCA创建数据库的时候报错TNS-04404
  • 原文地址:https://www.cnblogs.com/RzCong/p/7639455.html
Copyright © 2011-2022 走看看