记录hadoop3.2.2出现Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster问题

问题: hadoop3.2.2运行集群自带wordcount功能时出现以下错误:

[xiaobai@hadoop102 hadoop]$ hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.2.2.jar wordcount /wcinput /wcoutput
Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster

Please check whether your etc/hadoop/mapred-site.xml contains the below configuration:
<property>
  <name>yarn.app.mapreduce.am.env</name>
  <value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
<property>
  <name>mapreduce.map.env</name>
  <value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
<property>
  <name>mapreduce.reduce.env</name>
  <value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>

记录hadoop3.2.2出现Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster问题
原因: 提示很明显可以看出mapred.xml配置出现问题,按照提示补全mapred.xml配置;

解决方法:
增加如下内容:

        <!--运行hdfs自带wordcount功能出现错误-->
        <property>
                <name>yarn.app.mapreduce.am.env</name>
                <value>HADOOP_MAPRED_HOME=/opt/module/hadoop-3.2.2</value>
        </property>
        <property>
                <name>mapreduce.map.env</name>
                <value>HADOOP_MAPRED_HOME=/opt/module/hadoop-3.2.2</value>
        </property>
        <property>
                <name>mapreduce.reduce.env</name>
                <value>HADOOP_MAPRED_HOME=/opt/module/hadoop-3.2.2</value>
        </property>

再次执行:

[xiaobai@hadoop102 hadoop]$ hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.2.2.jar wordcount /wcinput /wcoutput

修改多次终于成功!
记录hadoop3.2.2出现Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster问题

上一篇:spring报错:java.io.FileNotFoundException: Could not open ServletContext resource [/jdbc.properties]


下一篇:centos6 下载官方,阿里,163yum源报错,无法解析地址和无法编译错误