背景描述:解决运行MapReduce时遇到:Container killed on request. Exit code is 143 问题分析:内存分配不足 需要对MapReduce和yarn的xml文件参数进行调整 在这里修改:
[master@hadoop102 hadoop]$ vim mapred-site.xml
增加内容为:
<property>
<name>mapreduce.map.memory.mb</name>
<value>1500</value>
<description>每个Map任务的物理内存限制</description>
</property>
<property>
<name>mapreduce.reduce.memory.mb</name>
<value>3000</value>
<description>每个Reduce任务的物理内存限制</description>
</property>
<property>
<name>mapreduce.map.java.opts</name>
<value>-Xmx1200m</value>
</property>
<property>
<name>mapreduce.reduce.java.opts</name>
<value>-Xmx2600m</value>
</property>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
然后修改yarn-site.xml 添加以下内容
[master@hadoop102 hadoop]$ vim yarn-site.xml
<property>
<name>yarn.nodemanager.resource.memory-mb</name>
<value>22528</value>
<discription>每个节点可用内存,单位MB</discription>
</property>
<property>
<name>yarn.scheduler.minimum-allocation-mb</name>
<value>1500</value>
<discription>单个任务可申请最少内存,默认1024MB</discription>
</property>
<property>
<name>yarn.scheduler.maximum-allocation-mb</name>
<value>16384</value>
<discription>单个任务可申请最大内存,默认8192MB</discription>
</property>
然后分发到hadoop103 104上,再重启集群 ,即可执行
stop-all.sh
start-all.sh
|