|NO.R.00002|——————————|Navigation|————|服务启动导航.v02|————|Hadoop.v02|yarn调整map&reduce参数.v02|
附录一:Mapreduce内存参数调整一:
附录三:报错处理一:
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart ——W.S.Landor
### --- 在mapreduce配置文件下配置
[root@hadoop02 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/mapred-site.xml
mapreduce.map.memory.mb
512
mapreduce.reduce.memory.mb
512
### --- 在yarn-site.xml下配置
[root@hadoop02 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/yarn-site.xml
yarn.scheduler.minimum-allocation-mb
100
yarn.scheduler.maximum-allocation-mb
1024
附录二:Mapreduce内存参数调整二:### --- yarn服务内存分配
~~~ # 由于我Yarn集群还需要跑Spark的任务,而Spark的Worker内存相对需要大些,所以需要调大单个任务的最大内存(默认为8G)。而Mapreduce的任务的内存配置:
~~~ # mapreduce.map.memory.mb:每个map任务的内存,应该是大于或者等于Container的最小内存。
~~~ # 按照上面的配置:每个slave可以运行map的数据<= 22528/1500,reduce任务的数量<=22528/3000
[root@hadoop01 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/yarn-site.xml
yarn.nodemanager.resource.memory-mb
1536
每个节点可用内存,单位MB
yarn.scheduler.minimum-allocation-mb
512
单个任务可申请最少内存,默认1024MB
yarn.scheduler.maximum-allocation-mb
1024
单个任务可申请最大内存,默认8192MB
yarn.app.mapreduce.am.resource.mb
300
单个任务,yarn下app运行内存,为300MB
mapreduce.map.memory.mb
300
每个Map任务的物理内存限制
mapreduce.reduce.memory.mb
300
每个Reduce任务的物理内存限制
mapreduce.map.java.opts
-Xmx200m
mapreduce.reduce.java.opts
-Xmx250m
附录三:报错处理一:
### --- 报错现象:
java.io.IOException: org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException: Invalid resource request, requested memory < 0, or requested memory > max configured, requestedMemory=1536, maxMemory=1024
### --- 报错分析:
~~~ yarn默认是设置1.5G内存来运行任务,但是虚拟机内存太小,没有1.5G,要改小运行任务内存
### --- 解决方案:
[root@hadoop03 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/yarn-site.xml
yarn.app.mapreduce.am.resource.mb
200
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart ——W.S.Landor