项目场景:Cloudera Oozie执行Shell脚本
使用Oozie作为调度器执行每日计算任务
问题描述:
在执行是出现Yarn内存超限
Container [pid=xxx,containerID=container_xxx] is running beyond physical memory limits. Current usage: 1.0 GB of 1 GB physical memory used; 7.1 GB of 2.1 GB virtual memory used. Killing container. Dump of the process-tree for container_xxx
原因分析:
内存超限:
申请内存超过最大限制内存!
解决方案:
通过Baidu搜索发现大部分都是让增大限制使用内存
将这两个配置增大:
AM1: mapreduce.map.memory.mb
AM2: mapreduce.reduce.memory.mb
但是在资源不是那么充足的情况下无法将其增大,增大也不能彻底解决这个问题。
注意:原因是申请内存>最大限制使用内存
那么需要配合使用map reduce的申请内存:
mapreduce.map.java.opts:AM1 * 0.8
mapreduce.reduce.java.opts:AM2 * 0.8
参考:
https://stackoverflow.com/questions/21005643/container-is-running-beyond-memory-limits
内存使用需要和核心数进行匹配
Configuration File | Configuration Setting | Value Calculation |
yarn-site.xml | yarn.nodemanager.resource.memory-mb | = Containers * RAM-per-Container |
yarn-site.xml | yarn.scheduler.minimum-allocation-mb | = RAM-per-Container |
yarn-site.xml | yarn.scheduler.maximum-allocation-mb | = containers * RAM-per-Container |
mapred-site.xml | mapreduce.map.memory.mb | = RAM-per-Container |
mapred-site.xml | mapreduce.reduce.memory.mb | = 2 * RAM-per-Container |
mapred-site.xml | mapreduce.map.java.opts | = 0.8 * RAM-per-Container |
mapred-site.xml | mapreduce.reduce.java.opts | = 0.8 * 2 * RAM-per-Container |
yarn-site.xml (check) | yarn.app.mapreduce.am.resource.mb | = 2 * RAM-per-Container |
yarn-site.xml (check) | yarn.app.mapreduce.am.command-opts | = 0.8 * 2 * RAM-per-Container |