我正在尝试将hadoop-mapreduce-examples-3.0.0.jar运行到hadoop集群(hadoop3.0.0),但我看到错误为无法找到或加载主类org.apache.hadoop.mapred。 YarnChild。
命令:hadoop jar hadoop-mapreduce-examples-3.0.0.jar pi 2 10
下面的图片是我的错误详情
<!-- core-site.xml -->
<property>
<name>fs.defaultFS</name>
<value>hdfs://master:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/tmp/hadoopdata</value>
</property>
<!-- hdfs-site.xml -->
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
<!-- yarn-site.xml -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>master</value>
</property>
<!-- mapred-site.xml -->
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>yarn.app.mapreduce.am.env</name>
<value>HADOOP_MAPRED_HOME=$HADOOP_COMMON_HOME</value>
</property>
我没有设置HADOOP_CLASSPATH,我不知道它是否有问题
答案 0 :(得分:1)
你应该在 yarn-site.xml 中添加属性
<property>
<name>yarn.application.classpath</name>
<value>
/opt/module/hadoop-3.1.3/etc/hadoop,
/opt/module/hadoop-3.1.3/share/hadoop/common/*,
/opt/module/hadoop-3.1.3/share/hadoop/common/lib/*,
/opt/module/hadoop-3.1.3/share/hadoop/hdfs/*,
/opt/module/hadoop-3.1.3/share/hadoop/hdfs/lib/*,
/opt/module/hadoop-3.1.3/share/hadoop/mapreduce/*,
/opt/module/hadoop-3.1.3/share/hadoop/mapreduce/lib/*,
/opt/module/hadoop-3.1.3/share/hadoop/yarn/*,
/opt/module/hadoop-3.1.3/share/hadoop/yarn/lib/*
</value>
</property>