前言:Hadoop 2.0以後,原先的MapReduce不在是簡單的離線批處理MR任務的框架,升級爲MapReduceV2(Yarn)版本,也就是把資源調度和任務分發兩塊分離開來。而在最新的CDH版本中,同時集成了MapReduceV1和MapReduceV2(Yarn)兩個版本,若是集羣中須要使用Yarn作統一的資源調度,建議使用Yarn。node
CDH對Yarn的部分參數作了少了修改,而且添加了相關的中文說明,本文着重介紹了CDH中相比 MapReduceV1一些參數改動的配置。app
ApplicationMaster 虛擬 CPU 內核框架
yarn.app.mapreduce.am.resource.cpu-vcores // ApplicationMaster佔用的cpu內核數(Gateway--資源管理 )jvm
容器虛擬 CPU 內核oop
yarn.nodemanager.resource.cpu-vcores //單 個NodeManager 最大能分配的cpu核數 (NodeManager --資源管理 )性能
結論:當前 nodemanager 申請的 ApplicationMaster數總 和小於 nodemanager最大cpu內核數優化
容器內存 spa
yarn.nodemanager.resource.memory-mb //單個NodeManager能分配的最大內存(NodeManager --資源管理) //Memory Total = 單個NodeManager內存 * 節點數日誌
結論:提交任務佔用內存Memory Used 小於Memory Total內存
Map 任務內存
mapreduce.map.memory.mb //爲做業的每一個 Map 任務分配的物理內存量 (Gateway--資源管理 )
結論:map或reduce的內存需求不大於appmaster的內存需求
最大容器內存
yarn.scheduler.maximum-allocation-mb //單個任務可申請最大內存 (ResourceManager--資源管理 )
Map 任務推理執行
mapreduce.map.speculative //Gateway
Reduce 任務推理執行
mapreduce.reduce.speculative //Gateway
啓用 Ubertask 優化 :
mapreduce.job.ubertask.enable | (默認false) //true則表示啓用jvm重用(Gateway--性能 )
jvm重用的決定參數以下:
Ubertask 最大 Map
mapreduce.job.ubertask.maxmaps //超過多少個map啓用jvm重用(Gateway--性能)
Ubertask 最大 Reduce
mapreduce.job.ubertask.maxreduces //超過多少 Reduce 啓用jvm重用,目前支持1個 (Gateway--性能)
Ubertask 最大做業大小
mapreduce.job.ubertask.maxbytes //application的輸入大小的閥值,默認爲 block大小(Gateway--性能)
給spark加日誌編輯 spark-defaults.conf
spark.yarn.historyServer.address=http://cloud003:18080/