MapReduce中的Java堆空间

时间:2016-08-30 17:28:23

标签: hadoop mapreduce yarn

我在具有32GB RAM的计算机上运行MapReduce作业,但是我收到了JAVA堆空间错误。我已将sprintf (oldname, "directory/MORE%04d/data", i); 设置为32GB,希望我有足够的内存来运行任务,但我猜不是。我应该如何配置MapReduce v2没有这个问题?

修改

yarn.nodemanager.resource.memory-mb

[2] 16/08/30 19:00:49 INFO mapreduce.Job: Task Id : attempt_1472579604725_0003_m_000000_0, Status : FAILED Error: Java heap space 16/08/30 19:00:55 INFO mapreduce.Job: Task Id : attempt_1472579604725_0003_m_000000_1, Status : FAILED Error: Java heap space 16/08/30 19:01:00 INFO mapreduce.Job: Task Id : attempt_1472579604725_0003_m_000000_2, Status : FAILED Error: Java heap space

mapred-site.xml

[3] <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Put site-specific property overrides in this file. --> <configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> <property> <name>mapreduce.jobhistory.done-dir</name> <value>/root/Programs/hadoop/logs/history/done</value> </property> <property> <name>mapreduce.jobhistory.intermediate-done-dir</name> <value>/root/Programs/hadoop/logs/history/intermediate-done-dir</value> </property> <property> <name>mapreduce.job.reduces</name> <value>2</value> </property> <!-- property> <name>yarn.nodemanager.resource.memory-mb</name> <value>10240</value> </property> <property> <name>yarn.scheduler.minimum-allocation-mb</name> <value>1024</value> </property --> <!-- property><name>mapreduce.task.files.preserve.failedtasks</name><value>true</value></property> <property><name>mapreduce.task.files.preserve.filepattern</name><value>*</value></property -->

yarn-site.xml

1 个答案:

答案 0 :(得分:0)

参数yarn.nodemanager.resource.memory-mb说明Yarn有多少资源可供使用(从评论中重复)

如果您希望mapreduce程序使用这些资源,您应该设置以下参数。

  

mapreduce.map.memory.mb

     

mapreduce.map.java.opts

     

mapreduce.reduce.memory.mb

     

mapreduce.reduce.java.opts

确保将java.opts设置为比memory.md小10-20%。