简体   繁体   English

在mapreduce作业提交期间为mapper和reducer配置内存

[英]Configuring memory for mappers and reducer during mapreduce job submission

I am trying to configure memory for mapper/reducer memory during a map reduce job submission as below: 我试图在映射减少作业提交期间为映射器/缩减器内存配置内存,如下所示:

hadoop jar Word-0.0.1-SNAPSHOT.jar -Dmapreduce.map.memory.mb=5120 com.test.Word.App /tmp/ilango/input /tmp/ilango/output/

Is there any wrong in the command above ? 上面的命令有什么错误吗? I am getting the following exception. 我收到以下异常。 It looks like do we need to put JAR file or need to configure what to use -D option in Hadoop. 看来我们需要放置JAR文件还是需要配置在Hadoop中使用-D选项。 Thanks in advance. 提前致谢。

Exception in thread "main" java.lang.ClassNotFoundException: -Dmapreduce.map.memory.mb=5120
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:270)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:205)

Command to run a MR job is 运行MR作业的命令是

hadoop jar jarname classname input output hadoop jar jarname类名输入输出

As per your command 根据您的命令

hadoop jar jarname -D mapreduce.map.memory.mb=5120 classname input output hadoop jar jarname -D mapreduce.map.memory.mb = 5120类名输入输出

hadoop checks Driver class with name " -Dmapreduce.map.memory.mb=5120 ". hadoop检查名称为“ -Dmapreduce.map.memory.mb = 5120 ”的驱动程序类。 Thats why it is showing java.lang.ClassNotFound Exception. 这就是为什么它显示java.lang.ClassNotFound异常的原因。

-D option should be supplied after your Driver class. -D选项应在Driver类之后提供。

Try using below command. 尝试使用以下命令。

hadoop jar Word-0.0.1-SNAPSHOT.jar  com.test.Word.App -D mapreduce.map.memory.mb=5120 /tmp/ilango/input /tmp/ilango/output/

Hope this solve your issue. 希望这能解决您的问题。

It looks like you are missing a space after -D 看起来您在-D之后缺少空格
try -D mapreduce.map.memory.mb=5120 尝试-D mapreduce.map.memory.mb=5120

There is a difference between -Dproperty=value and -D property=value . -Dproperty = value-D property = value之间有区别。 The first one sets JVM system property where as the second one sets the Hadoop configuration property. 第一个设置JVM系统属性,而第二个设置Hadoop配置属性。

Quoting from the book Hadoop the Definitive guide, : 引用《 Hadoop权威指南》这本书:

-D property=value Sets the given Hadoop configuration property to the given value. -D property = value将给定的Hadoop配置属性设置为给定的值。 Overrides any default or site properties in the configuration, and any properties set via the -conf option. 覆盖配置中的任何默认或站点属性,以及通过-conf选项设置的任何属性。

If you're using MVN and added the Main class to the manifest, in this case com.test.Word.App , your command -D mapreduce.map.memory.mb=5120 will be taken as input. 如果您正在使用MVN并将Main类添加到清单(在本例中为com.test.Word.App ,则将-D mapreduce.map.memory.mb=5120命令作为输入。

So, just remove the com.test.Word.App line 因此,只需删除com.test.Word.App

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM