Hadoop YARN資源管理-公平調度器(Fackbook的Fair Scheduler)


   Hadoop YARN資源管理-公平調度器(Fackbook的Fair Scheduler)

                                  作者:尹正傑 

版權聲明:原創作品,謝絕轉載!否則將追究法律責任。

 

 

  之前我分享了配置容量調度器(Apache Hadoop默認的調度器)的筆記,今天我們來學習另一個重要的Hadoop資源調度器,即公平調度器,當然,它也是CDH默認的調度器。

 

一.公平調度器概述

1>.YARN資源調度器概述

  博主推薦閱讀:
    https://www.cnblogs.com/yinzhengjie/p/13341939.html

2>.隊列

  隊列使得調度器能夠分配資源。所有集群用戶都被分配一個名為"default"的隊列。可以在層次結構中排列隊列,還可以使用權重配置隊列,以便微調集群中的資源分配。

  為了確保特定用戶或應用程序始終獲得所需的資源,公平調度器允許將保證的最小份額分配給隊列。

  應用程序或用戶始終得到最小共享保證,但調度器可確保隊列中不會有閑置未使用的資源。當分配有保證資源的任何隊列由於隊列未運行應用程序而具有剩余資源時,集群會將剩余資源分配給其它應用程序。

  應用程序被提交到一個特定的隊列,在默認情況下每個用戶都有自己的隊列。還可以創建自定義隊列,以確保最小資源,並為每個隊列設置權重以指定優先級。

  公平調度器依賴於以分層方式構建的資源隊列或池。所有隊列都從名為根隊列的同一個祖先繼承。后代隊列稱為葉子隊列,應用程序將在葉子隊列上調度。葉子隊列可以擁有更多級別的子隊列。

  可以在fair-scheduler.xml文件中定義隊列,並將其命名為以父隊列開頭的名稱(例如:"root.default"),請注意,引用隊列時,可以不指定隊列名稱的根部分。Hadoop以公平的方式將集群資源分配到根隊列的子隊列中。

  溫馨提示:
    Hadoop會每10秒自動加載fair-scheduler.xml文件,所以對Fair Scheduler配置所做的任何更改幾乎都會成功生效。沒有必要像在修改容量調度器的配置時那樣手動運行"yarn rmadmin -refreshQueues"命令喲~

 

二.配置公平調度器

1>.啟用公平調度器策略並指定"fair-cheduler.xml"文件路徑

  [root@hadoop101.yinzhengjie.com ~]# vim ${HADOOP_HOME}/etc/hadoop/yarn-site.xml
  ...
  <!-- 配置公平調度器 -->
  <property>
    <name>yarn.resourcemanager.scheduler.class</name>
    <value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler</value>
    <description>指定resourcemanager的調度器(如上所示,默認為容量調度器),我這里指定的是公平調度器</description>
  </property>

  <property>
    <name>yarn.scheduler.fair.allocation.file</name>
    <value>/yinzhengjie/softwares/hadoop/etc/hadoop/conf/fair-scheduler.xml</value>
    <description>指定公平調度器的配置文件所在路徑,hadoop會每間隔10秒自動加載該文件,而無需向容量調度器那樣手動運行"yarn rmadmin -refreshQueues"命令。</description>
  </property>
  ...
  [root@hadoop101.yinzhengjie.com ~]# 

  溫馨提示:
    (1)通過編輯分配文件(就是我上面指定的"
fair-scheduler.xml"文件路徑),可以在運行時修改最小份額,限制,權重,搶占超時和隊列調度策略。計划程序會在看到文件已被修改后10-15秒重新加載該文件。
    (2)編輯"fair-scheduler.xml"文件時,若對已經存在的隊列進行更名時,新更名的隊列會在10-15秒內自動創建出來,但原來存在的隊列名稱依舊存在,知道你重啟YARN集群時它才會自動消失喲;

2>.fair-scheduler.xml文件格式說明

  分配文件(${HADOOP_HOME}/etc/hadoop/conf/fair-scheduler.xml)必須為XML格式。該格式包含五種類型的元素:

  Queue elements: 
    代表隊列。隊列元素可以采用可選屬性'type',將其設置為'parent'使其成為父隊列。當我們要創建父隊列而不配置任何葉隊列時,這很有用。每個隊列元素可能包含以下屬性:
      minResources:  
        隊列有權使用的最少資源。對於單資源公平性策略,僅使用內存,而忽略其他資源。如果不滿足隊列的最小份額,將在同一父項下的任何其他隊列之前為它提供可用資源。
        在單資源公平性策略下,如果隊列的內存使用率低於其最小內存份額,則認為該隊列不滿意。在支配資源公平的情況下,如果隊列在集群資源中相對於集群容量的使用率低於該資源的最小份額,則認為該隊列不滿足要求。
        如果在這種情況下無法滿足多個隊列,則資源以相關資源使用率與其最小值之間的最小比率進入隊列。
      maxResources: 
        可以分配隊列的最大資源。不會為隊列分配一個容器,該容器的總使用量將超過此限制。此限制是遞歸實施的,如果該分配會使隊列或其父級超過最大資源,則不會為該隊列分配容器。
      maxContainerAllocation: 
        隊列可以為單個容器分配的最大資源。如果未設置該屬性,則其值將從父隊列繼承。默認值為yarn.scheduler.maximum-allocation-mb和yarn.scheduler.maximum-allocation-vcores。不能高於maxResources。該屬性對於根隊列無效。
      maxChildResources: 
        可以分配臨時子隊列的最大資源。子隊列限制是遞歸實施的,因此,如果該分配會使子隊列或其父隊列超出最大資源,則不會分配容器。
        對於minResources,maxResources,maxContainerAllocation和maxChildResources屬性,可以使用以下一種格式給出參數:
          舊格式:"X mb,Y vcores""X% cpu,Y% memory""X%"。如果未提供單個百分比,則必須同時配置內存和cpu,而忽略其他資源類型並將其設置為零。
          新格式(推薦):"vcores = X,memory-mb = Y""vcores = X%,memory-mb = Y%"。可以看出,以這種格式,可以給出百分比或整數的無單位資源值。
        在后一種情況下,將根據為該資源配置的默認單位來推斷單位。當指定了內存和CPU以外的資源時,需要這種格式。
        如果使用minResources,則任何未指定的資源都將設置為0;如果使用maxResources,maxContainerAllocation和maxChildResources,則該資源的最大值將設置為0。
      maxRunningApps: 
        限制隊列中一次運行的應用程序數量。
      maxAMShare: 
        限制可用於運行應用程序主服務器的隊列公平份額的比例。此屬性只能用於葉隊列。例如,如果設置為1.0f,則葉隊列中的AM最多可以占用100%的內存和CPU公平份額。-1.0f的值將禁用此功能,並且不會檢查amShare。默認值為0.5f。
      weight: 
        與其他隊列不成比例地共享集群。權重默認為1,權重為2的隊列所接收的資源大約是權重為默認隊列的兩倍。
      schedulingPolicy: 
        可以根據用戶名和組以及應用程序請求的隊列配置將提交的應用程序放入適當隊列的策略。調度策略使用規則來順序地評估,並將新的的應用程序置於隊列中。在fair-scheduler.xml文件中,可以設置以下幾種調度策略:
          fifo:
            優先考慮具有較早提交時間的應用程序的容器,但是如果滿足較早應用程序的請求后群集上仍有剩余空間,則較晚提交的應用程序可以同時運行。
          fair:
            公平調度策略是默認值。
          drf:
            主導資源公平策略。
        雖然可以指定上述列出的三個值之一,但實際上可以使用任何擴展了"org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.SchedulingPolicy"的類。
      aclSubmitApps: 
        可以將應用程序提交到隊列的用戶和/或組的列表。有關此列表的格式以及隊列ACL如何工作的更多信息,請參考官網的ACL部分。
      aclAdministerApps: 
        可以管理隊列的用戶和/或組的列表。當前,唯一的管理操作是殺死應用程序。有關此列表的格式以及隊列ACL如何工作的更多信息,請參考官網的ACL部分。
      minSharePreemptionTimeout: 
        隊列在嘗試搶占容器以從其他隊列中獲取資源之前,處於其最小份額之下的秒數。如果未設置,則隊列將從其父隊列繼承值。默認值為Long.MAX_VALUE,這意味着它在設置有意義的值之前不會搶占容器。
      fairSharePreemptionTimeout: 
        隊列在嘗試搶占容器以從其他隊列中獲取資源之前,處於其公平份額閾值以下的秒數。如果未設置,則隊列將從其父隊列繼承值。默認值為Long.MAX_VALUE,這意味着它在設置有意義的值之前不會搶占容器。
      fairSharePreemptionThreshold: 
        隊列的公平份額搶占閾值。如果隊列在等待fairSharePreemptionTimeout而沒有收到fairSharePreemptionThreshold * fairShare資源,則可以搶占容器以從其他隊列中獲取資源。如果未設置,則隊列將從其父隊列繼承值。默認值為0.5f。
      allowPreemptionFrom: 
        確定是否允許調度程序從隊列中搶占資源。默認值為true。如果隊列的此屬性設置為false,則此屬性將遞歸應用於所有子隊列。
      reservation: 
        表示該ReservationSystem隊列的資源可供用戶儲備。這僅適用於葉子隊列。如果未配置此屬性,則無法保留葉隊列。

  User elements: 
    代表控制各個用戶行為的設置。它們可以包含一個屬性:maxRunningApps,一個特定用戶正在運行的應用程序數量的限制。

  A userMaxAppsDefault element: 
    它為未另外指定限制的任何用戶設置默認的運行應用程序限制。

  A defaultFairSharePreemptionTimeout element: 
    設置根隊列的公平搶占超時。被根隊列中的fairSharePreemptionTimeout元素覆蓋。默認設置為Long.MAX_VALUE。

  A defaultMinSharePreemptionTimeout element: 
    設置根隊列的最小共享搶占超時;由根隊列中的minSharePreemptionTimeout元素覆蓋。默認設置為Long.MAX_VALUE。

  A defaultFairSharePreemptionThreshold element: 
    設置根隊列的公平份額搶占閾值;被根隊列中的fairSharePreemptionThreshold元素覆蓋。默認設置為0.5f。

  A queueMaxAppsDefault element: 
    設置隊列的默認運行應用程序限制;在每個隊列中被maxRunningApps元素覆蓋。

  A queueMaxResourcesDefault element: 
    設置隊列的默認最大資源限制;在每個隊列中被maxResources元素覆蓋。

  A queueMaxAMShareDefault element: 
    設置隊列的默認AM資源限制。在每個隊列中被maxAMShare元素覆蓋。

  A defaultQueueSchedulingPolicy element: 
    設置隊列的默認調度策略。如果指定,則由每個隊列中的schedulePolicy元素覆蓋。默認為"fair"。

  A reservation-agent element: 
    設置ReservationAgent的實現的類名,該類試圖將用戶的預訂請求放入Plan中。默認值為org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.AlignedPlannerWithGreedy。

  A reservation-policy element: 
    設置SharingPolicy實現的類名,它驗證新的保留是否不違反任何不變式。默認值為org.apache.hadoop.yarn.server.resourcemanager.reservation.CapacityOverTimePolicy。

  A reservation-planner element: 
    設置Planner的實現的類名稱,如果Plan容量低於(由於計划的維護或節點故障轉移)用戶保留的資源,則調用該元素。
    默認值為org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.SimpleCapacityReplanner,它掃描計划並按相反的接受順序(LIFO)貪婪地刪除保留,直到保留的資源在計划容量之內。

  A queuePlacementPolicy element: 
    包含規則元素列表,這些規則元素告訴調度程序如何將傳入的應用程序放入隊列中。規則以列出順序應用。規則可能會引起爭論。所有規則都接受“創建”參數,該參數指示規則是否可以創建新隊列。“創建”默認為true;

    如果設置為false且該規則會將應用程序放置在分配文件中未配置的隊列中,則我們繼續執行下一條規則。最后一條規則必須是永遠不能發出繼續的規則。有效規則如下所是:
      specified: 
        將應用放入請求的隊列中。如果應用程序沒有請求隊列,即應用配置的"default"規則,則我們繼續。如果應用程序請求隊列名稱以句號開頭或結尾,即".q1""q1"之類的名稱。將被拒絕。
      user: 
        應用程序以提交用戶的名稱放入隊列中。用戶名中的句點將被替換為"_dot_",即用戶"first.last"的隊列名稱為"first_dot_last"。
      primaryGroup: 
        將應用程序放入隊列中,隊列中包含提交該應用程序的用戶的主要組的名稱。組名中的句點將被替換為"_dot_",即組"one.two"的隊列名稱為"one_dot_two"。
      secondaryGroupExistingQueue: 
        將應用程序放入隊列中,該隊列的名稱與提交該應用程序的用戶的次要組相匹配。
        將選擇與已配置隊列匹配的第一個輔助組。組名中的句點將被替換為"_dot_",即,如果存在這樣一個隊列,則以"one.two"作為其次要組之一的用戶將被放入"one_dot_two"隊列中。
      nestedUserQueue: 
        將應用程序放入用戶隊列中,用戶名位於嵌套規則建議的隊列下。這類似於"user"規則,區別在於"nestedUserQueue"規則,可以在任何父隊列下創建用戶隊列,而"user"規則僅在根隊列下創建用戶隊列。
        請注意,僅當嵌套規則返回父隊列時,才會應用nestedUserQueue規則。可以通過將隊列的"type"屬性設置為"parent"來配置父隊列,或者通過在該隊列下配置至少一個葉子作為父節點來配置父隊列。有關示例用例,請參見分配示例。
      default: 
        將應用程序放入默認規則的'queue'屬性中指定的隊列中。如果未指定'queue'屬性,則將應用程序放置在'root.default'隊列中。
      reject: 
        該應用程序被拒絕。

  溫馨提示:
    為了與原始FairScheduler向后兼容,可以將"queue"元素命名為"pool"元素。

  博主推薦閱讀:
    https://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/FairScheduler.html

3>.一個fair-scheduler.xml示例文件

[root@hadoop101.yinzhengjie.com ~]# mkdir -v ${HADOOP_HOME}/etc/hadoop/conf
mkdir: created directory ‘/yinzhengjie/softwares/hadoop/etc/hadoop/conf’
[root@hadoop101.yinzhengjie.com ~]# 
[root@hadoop101.yinzhengjie.com ~]# vim ${HADOOP_HOME}/etc/hadoop/conf/fair-scheduler.xml
[root@hadoop101.yinzhengjie.com ~]# 
[root@hadoop101.yinzhengjie.com ~]# cat ${HADOOP_HOME}/etc/hadoop/conf/fair-scheduler.xml
<?xml version="1.0"?>
<allocations>
  <queue name="yinzhengjie">
    <minResources>2048 mb,1vcores</minResources>
    <maxResources>4096 mb,4vcores</maxResources>
    <maxRunningApps>50</maxRunningApps>
    <maxAMShare>0.1</maxAMShare>
    <weight>2.0</weight>
    <schedulingPolicy>fair</schedulingPolicy>
    <queue name="operation" >
      <queue name="op_queue01" ></queue>
      <queue name="op_queue02" ></queue>
    </queue>
    <queue name="development" ></queue>
    <queue name="testing" ></queue>
  </queue>

  <queueMaxAMShareDefault>0.5</queueMaxAMShareDefault>
  <queueMaxResourcesDefault>4096 mb,6vcores</queueMaxResourcesDefault>

  <!--
    不同於容量調度器,公平調度器設計了一個基於規則的系統來為作業分配調度隊列。
    它內置了一套規則可以插拔式的配置。定義分配規則使用<queuePlacementPolicy/>標簽,具體條件使用<rule/>定義。
    下面的規則我就不重復介紹了,詳情可參考:"https://www.cnblogs.com/yinzhengjie/p/13789883.html"
    關於create屬性:
        若匹配到已經存在的隊列,則將作業放到改隊列,若匹配不到已經存在的隊列,則根據create來選擇是否創建隊列,默認值是true。
        例如,若<rule name="user" create=true/>,此時用戶jason提交作業,調度器就會尋找是否有名字為jason的隊列,若沒有,就會創建名字為jason的隊列,並將這個作業放到該隊列中。
   -->
  <queuePlacementPolicy>
    <rule name="specified" create="false" />
    <rule name="primaryGroup" create="false" />
    <rule name="nestedUserQueue" create="false ">
        <rule name="secondaryGroupExistingQueue" create="false" />
    </rule>
    <rule name="default" queue="root.yinzhengjie.operation.op_queue01"/>
  </queuePlacementPolicy>
</allocations>
[root@hadoop101.yinzhengjie.com ~]# 

溫馨提示:   
  如下圖所示,配置文件成功后,在間隔10-15秒內會自動刷新配置文件,我們可以在RM Web UI查看調度器隊列的情況。

 

三.將作業提交到調度器

1>.將作業提交到指定"root.yinzhengjie.development"隊列

[root@hadoop101.yinzhengjie.com ~]# hadoop jar ${HADOOP_HOME}/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.0.jar wordcount -D mapreduce.job.queuename=root.yinzhengjie.development /input /output
20/11/01 14:43:18 INFO client.RMProxy: Connecting to ResourceManager at hadoop101.yinzhengjie.com/172.200.6.101:8032
20/11/01 14:43:18 INFO input.FileInputFormat: Total input files to process : 1
20/11/01 14:43:18 INFO mapreduce.JobSubmitter: number of splits:1
20/11/01 14:43:19 INFO Configuration.deprecation: yarn.resourcemanager.system-metrics-publisher.enabled is deprecated. Instead, use yarn.system-metrics-publisher.enabled
20/11/01 14:43:19 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1604212993675_0001
20/11/01 14:43:19 INFO conf.Configuration: resource-types.xml not found
20/11/01 14:43:19 INFO resource.ResourceUtils: Unable to find 'resource-types.xml'.
20/11/01 14:43:19 INFO resource.ResourceUtils: Adding resource type - name = memory-mb, units = Mi, type = COUNTABLE
20/11/01 14:43:19 INFO resource.ResourceUtils: Adding resource type - name = vcores, units = , type = COUNTABLE
20/11/01 14:43:19 INFO impl.YarnClientImpl: Submitted application application_1604212993675_0001
20/11/01 14:43:19 INFO mapreduce.Job: The url to track the job: http://hadoop101.yinzhengjie.com:8088/proxy/application_1604212993675_0001/
20/11/01 14:43:19 INFO mapreduce.Job: Running job: job_1604212993675_0001
20/11/01 14:43:25 INFO mapreduce.Job: Job job_1604212993675_0001 running in uber mode : false
20/11/01 14:43:25 INFO mapreduce.Job:  map 0% reduce 0%
20/11/01 14:43:30 INFO mapreduce.Job:  map 100% reduce 0%
20/11/01 14:43:37 INFO mapreduce.Job:  map 100% reduce 100%
20/11/01 14:43:39 INFO mapreduce.Job: Job job_1604212993675_0001 completed successfully
20/11/01 14:43:39 INFO mapreduce.Job: Counters: 49
    File System Counters
        FILE: Number of bytes read=1014
        FILE: Number of bytes written=419577
        FILE: Number of read operations=0
        FILE: Number of large read operations=0
        FILE: Number of write operations=0
        HDFS: Number of bytes read=781
        HDFS: Number of bytes written=708
        HDFS: Number of read operations=6
        HDFS: Number of large read operations=0
        HDFS: Number of write operations=2
    Job Counters 
        Launched map tasks=1
        Launched reduce tasks=1
        Data-local map tasks=1
        Total time spent by all maps in occupied slots (ms)=2384
        Total time spent by all reduces in occupied slots (ms)=3710
        Total time spent by all map tasks (ms)=2384
        Total time spent by all reduce tasks (ms)=3710
        Total vcore-milliseconds taken by all map tasks=2384
        Total vcore-milliseconds taken by all reduce tasks=3710
        Total megabyte-milliseconds taken by all map tasks=4882432
        Total megabyte-milliseconds taken by all reduce tasks=7598080
    Map-Reduce Framework
        Map input records=3
        Map output records=99
        Map output bytes=1057
        Map output materialized bytes=1014
        Input split bytes=119
        Combine input records=99
        Combine output records=75
        Reduce input groups=75
        Reduce shuffle bytes=1014
        Reduce input records=75
        Reduce output records=75
        Spilled Records=150
        Shuffled Maps =1
        Failed Shuffles=0
        Merged Map outputs=1
        GC time elapsed (ms)=81
        CPU time spent (ms)=780
        Physical memory (bytes) snapshot=483950592
        Virtual memory (bytes) snapshot=7208615936
        Total committed heap usage (bytes)=386400256
    Shuffle Errors
        BAD_ID=0
        CONNECTION=0
        IO_ERROR=0
        WRONG_LENGTH=0
        WRONG_MAP=0
        WRONG_REDUCE=0
    File Input Format Counters 
        Bytes Read=662
    File Output Format Counters 
        Bytes Written=708
[root@hadoop101.yinzhengjie.com ~]# 
 
[root@hadoop101.yinzhengjie.com ~]# hadoop jar ${HADOOP_HOME}/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.0.jar wordcount -D mapreduce.job.queuename=root.yinzhengjie.development /input /output

2>.將作業提交到指定"root.yinzhengjie.testing"隊列

[root@hadoop101.yinzhengjie.com ~]# hadoop jar ${HADOOP_HOME}/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.0.jar wordcount -D mapreduce.job.queuename=root.yinzhengjie.testing /input /output
20/11/01 15:15:26 INFO client.RMProxy: Connecting to ResourceManager at hadoop101.yinzhengjie.com/172.200.6.101:8032
20/11/01 15:15:26 INFO input.FileInputFormat: Total input files to process : 1
20/11/01 15:15:27 INFO mapreduce.JobSubmitter: number of splits:1
20/11/01 15:15:27 INFO Configuration.deprecation: yarn.resourcemanager.system-metrics-publisher.enabled is deprecated. Instead, use yarn.system-metrics-publisher.enabled
20/11/01 15:15:27 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1604212993675_0002
20/11/01 15:15:27 INFO conf.Configuration: resource-types.xml not found
20/11/01 15:15:27 INFO resource.ResourceUtils: Unable to find 'resource-types.xml'.
20/11/01 15:15:27 INFO resource.ResourceUtils: Adding resource type - name = memory-mb, units = Mi, type = COUNTABLE
20/11/01 15:15:27 INFO resource.ResourceUtils: Adding resource type - name = vcores, units = , type = COUNTABLE
20/11/01 15:15:27 INFO impl.YarnClientImpl: Submitted application application_1604212993675_0002
20/11/01 15:15:27 INFO mapreduce.Job: The url to track the job: http://hadoop101.yinzhengjie.com:8088/proxy/application_1604212993675_0002/
20/11/01 15:15:27 INFO mapreduce.Job: Running job: job_1604212993675_0002
20/11/01 15:15:33 INFO mapreduce.Job: Job job_1604212993675_0002 running in uber mode : false
20/11/01 15:15:33 INFO mapreduce.Job:  map 0% reduce 0%
20/11/01 15:15:37 INFO mapreduce.Job:  map 100% reduce 0%
20/11/01 15:15:41 INFO mapreduce.Job:  map 100% reduce 100%
20/11/01 15:15:42 INFO mapreduce.Job: Job job_1604212993675_0002 completed successfully
20/11/01 15:15:42 INFO mapreduce.Job: Counters: 49
    File System Counters
        FILE: Number of bytes read=1014
        FILE: Number of bytes written=419253
        FILE: Number of read operations=0
        FILE: Number of large read operations=0
        FILE: Number of write operations=0
        HDFS: Number of bytes read=781
        HDFS: Number of bytes written=708
        HDFS: Number of read operations=6
        HDFS: Number of large read operations=0
        HDFS: Number of write operations=2
    Job Counters 
        Launched map tasks=1
        Launched reduce tasks=1
        Data-local map tasks=1
        Total time spent by all maps in occupied slots (ms)=1934
        Total time spent by all reduces in occupied slots (ms)=2029
        Total time spent by all map tasks (ms)=1934
        Total time spent by all reduce tasks (ms)=2029
        Total vcore-milliseconds taken by all map tasks=1934
        Total vcore-milliseconds taken by all reduce tasks=2029
        Total megabyte-milliseconds taken by all map tasks=3960832
        Total megabyte-milliseconds taken by all reduce tasks=4155392
    Map-Reduce Framework
        Map input records=3
        Map output records=99
        Map output bytes=1057
        Map output materialized bytes=1014
        Input split bytes=119
        Combine input records=99
        Combine output records=75
        Reduce input groups=75
        Reduce shuffle bytes=1014
        Reduce input records=75
        Reduce output records=75
        Spilled Records=150
        Shuffled Maps =1
        Failed Shuffles=0
        Merged Map outputs=1
        GC time elapsed (ms)=89
        CPU time spent (ms)=840
        Physical memory (bytes) snapshot=515182592
        Virtual memory (bytes) snapshot=7209365504
        Total committed heap usage (bytes)=388497408
    Shuffle Errors
        BAD_ID=0
        CONNECTION=0
        IO_ERROR=0
        WRONG_LENGTH=0
        WRONG_MAP=0
        WRONG_REDUCE=0
    File Input Format Counters 
        Bytes Read=662
    File Output Format Counters 
        Bytes Written=708
[root@hadoop101.yinzhengjie.com ~]# 
[root@hadoop101.yinzhengjie.com ~]# hadoop jar ${HADOOP_HOME}/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.0.jar wordcount -D mapreduce.job.queuename=root.yinzhengjie.testing /input /output

3>.不指定提交的隊列,運行Job觀察默認規則是否生效

[root@hadoop101.yinzhengjie.com ~]# hdfs dfs -rm -r /output
20/11/01 15:17:48 INFO fs.TrashPolicyDefault: Moved: 'hdfs://hadoop101.yinzhengjie.com:9000/output' to trash at: hdfs://hadoop101.yinzhengjie.com:9000/user/root/.Trash/Current/output1604215
068898[root@hadoop101.yinzhengjie.com ~]# 
[root@hadoop101.yinzhengjie.com ~]# 
[root@hadoop101.yinzhengjie.com ~]# hadoop jar ${HADOOP_HOME}/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.0.jar wordcount /input /output
20/11/01 15:18:02 INFO client.RMProxy: Connecting to ResourceManager at hadoop101.yinzhengjie.com/172.200.6.101:8032
20/11/01 15:18:03 INFO input.FileInputFormat: Total input files to process : 1
20/11/01 15:18:03 INFO mapreduce.JobSubmitter: number of splits:1
20/11/01 15:18:03 INFO Configuration.deprecation: yarn.resourcemanager.system-metrics-publisher.enabled is deprecated. Instead, use yarn.system-metrics-publisher.enabled
20/11/01 15:18:03 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1604212993675_0003
20/11/01 15:18:03 INFO conf.Configuration: resource-types.xml not found
20/11/01 15:18:03 INFO resource.ResourceUtils: Unable to find 'resource-types.xml'.
20/11/01 15:18:03 INFO resource.ResourceUtils: Adding resource type - name = memory-mb, units = Mi, type = COUNTABLE
20/11/01 15:18:03 INFO resource.ResourceUtils: Adding resource type - name = vcores, units = , type = COUNTABLE
20/11/01 15:18:03 INFO impl.YarnClientImpl: Submitted application application_1604212993675_0003
20/11/01 15:18:03 INFO mapreduce.Job: The url to track the job: http://hadoop101.yinzhengjie.com:8088/proxy/application_1604212993675_0003/
20/11/01 15:18:03 INFO mapreduce.Job: Running job: job_1604212993675_0003
20/11/01 15:18:09 INFO mapreduce.Job: Job job_1604212993675_0003 running in uber mode : false
20/11/01 15:18:09 INFO mapreduce.Job:  map 0% reduce 0%
20/11/01 15:18:14 INFO mapreduce.Job:  map 100% reduce 0%
20/11/01 15:18:20 INFO mapreduce.Job:  map 100% reduce 100%
20/11/01 15:18:20 INFO mapreduce.Job: Job job_1604212993675_0003 completed successfully
20/11/01 15:18:20 INFO mapreduce.Job: Counters: 49
    File System Counters
        FILE: Number of bytes read=1014
        FILE: Number of bytes written=419187
        FILE: Number of read operations=0
        FILE: Number of large read operations=0
        FILE: Number of write operations=0
        HDFS: Number of bytes read=781
        HDFS: Number of bytes written=708
        HDFS: Number of read operations=6
        HDFS: Number of large read operations=0
        HDFS: Number of write operations=2
    Job Counters 
        Launched map tasks=1
        Launched reduce tasks=1
        Data-local map tasks=1
        Total time spent by all maps in occupied slots (ms)=1922
        Total time spent by all reduces in occupied slots (ms)=1977
        Total time spent by all map tasks (ms)=1922
        Total time spent by all reduce tasks (ms)=1977
        Total vcore-milliseconds taken by all map tasks=1922
        Total vcore-milliseconds taken by all reduce tasks=1977
        Total megabyte-milliseconds taken by all map tasks=3936256
        Total megabyte-milliseconds taken by all reduce tasks=4048896
    Map-Reduce Framework
        Map input records=3
        Map output records=99
        Map output bytes=1057
        Map output materialized bytes=1014
        Input split bytes=119
        Combine input records=99
        Combine output records=75
        Reduce input groups=75
        Reduce shuffle bytes=1014
        Reduce input records=75
        Reduce output records=75
        Spilled Records=150
        Shuffled Maps =1
        Failed Shuffles=0
        Merged Map outputs=1
        GC time elapsed (ms)=89
        CPU time spent (ms)=950
        Physical memory (bytes) snapshot=490921984
        Virtual memory (bytes) snapshot=7208210432
        Total committed heap usage (bytes)=388497408
    Shuffle Errors
        BAD_ID=0
        CONNECTION=0
        IO_ERROR=0
        WRONG_LENGTH=0
        WRONG_MAP=0
        WRONG_REDUCE=0
    File Input Format Counters 
        Bytes Read=662
    File Output Format Counters 
        Bytes Written=708
[root@hadoop101.yinzhengjie.com ~]# 
[root@hadoop101.yinzhengjie.com ~]# hadoop jar ${HADOOP_HOME}/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.0.jar wordcount /input /output

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM