CDH集群中YARN的參數配置
前言:Hadoop 2.0之后,原先的MapReduce不在是簡單的離線批處理MR任務的框架,升級為MapReduceV2(Yarn)版本,也就是把資源調度和任務分發兩塊分離開來。而在最新的CDH版本中,同時集成了MapReduceV1和MapReduceV2(Yarn)兩個版本,如果集群中需要使用Yarn做統一的資源調度,建議使用Yarn。
CDH對Yarn的部分參數做了少了修改,並且添加了相關的中文說明,本文着重介紹了CDH中相比 MapReduceV1一些參數改動的配置。
一、CPU配置
ApplicationMaster 虛擬 CPU 內核
yarn.app.mapreduce.am.resource.cpu-vcores // ApplicationMaster占用的cpu內核數(Gateway--資源管理 )
容器虛擬 CPU 內核
yarn.nodemanager.resource.cpu-vcores //單 個NodeManager 最大能分配的cpu核數 (NodeManager --資源管理 )
結論:當前 nodemanager 申請的 ApplicationMaster數總 和小於 nodemanager最大cpu內核數
二、內存配置
容器內存
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或者Reduce 並行執行
Map 任務推理執行
mapreduce.map.speculative //Gateway
Reduce 任務推理執行
mapreduce.reduce.speculative //Gateway
四、JVM重用
啟用 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/
