在 mapred-site.xml文件中添加以下内容:
<property>
<name>yarn.app.mapreduce.am.env</name>
<value>HADOOP_MAPRED_HOME=$HADOOP_COMMON_HOME</value>
</property>
<property>
<name>mapreduce.map.env</name>
<value>HADOOP_MAPRED_HOME=$HADOOP_COMMON_HOME</value>
</property>
<property>
<name>mapreduce.reduce.env</name>
<value>HADOOP_MAPRED_HOME=$HADOOP_COMMON_HOME</value>
</property>
<property>
<name>yarn.application.classpath</name>
<value>/opt/module/hadoop-3.1.4/etc/hadoop:/opt/module/hadoop-3.1.4/share/hadoop/common/lib/*:/opt/module/hadoop-3.1.4/share/hadoop/common/*:/opt/module/hadoop-3.1.4/share/hadoop/hdfs:/opt/module/hadoop-3.1.4/share/hadoop/hdfs/lib/*:/opt/module/hadoop-3.1.4/share/hadoop/hdfs/*:/opt/module/hadoop-3.1.4/share/hadoop/mapreduce/lib/*:/opt/module/hadoop-3.1.4/share/hadoop/mapreduce/*:/opt/module/hadoop-3.1.4/share/hadoop/yarn:/opt/module/hadoop-3.1.4/share/hadoop/yarn/lib/*:/opt/module/hadoop-3.1.4/share/hadoop/yarn/*</value>
</property>
最后一项为在命令行输入hadoop classpath 的结果。