Hadoop3.1.3下成功安装后,进行MapReduce操作出现错误:
错误: 找不到或无法加载主类org.apache.hadoop.mapreduce.v2.app.MRAppMaster
解决办法:
① 在命令行下输入如下命令,并将返回的地址复制。
$ hadoop classpath
/usr/local/hadoop/hadoop-3.1.3/etc/hadoop:/usr/local/hadoop/hadoop-3.1.3//share/hadoop/common/lib/*:/usr/local/hadoop/hadoop-3.1.3//share/hadoop/common/*:/usr/local/hadoop/hadoop-3.1.3//share/hadoop/hdfs:/usr/local/hadoop/hadoop-3.1.3//share/hadoop/hdfs/lib/*:/usr/local/hadoop/hadoop-3.1.3//share/hadoop/hdfs/*:/usr/local/hadoop/hadoop-3.1.3//share/hadoop/mapreduce/lib/*:/usr/local/hadoop/hadoop-3.1.3//share/hadoop/mapreduce/*:/usr/local/hadoop/hadoop-3.1.3//share/hadoop/yarn:/usr/local/hadoop/hadoop-3.1.3//share/hadoop/yarn/lib/*:/usr/local/hadoop/hadoop-3.1.3//share/hadoop/yarn/*
② 编辑yarn-site.xml
vim yarn-site.xml
#添加如下内容
<configuration>
<property>
<name>yarn.application.classpath</name>
<value>/usr