HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}

场景

在Hadoop3.13YARN上运行MapReduce

报错信息

终端界面提示
FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
再查YARN历史
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>

解决方案

vi $HADOOP_HOME/etc/hadoop/yarn-site.xml

<property>
    <name>yarn.nodemanager.env-whitelistname>
    <value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOMEvalue>
property>

修改值 和 默认值 的区别

  • 修改值:
    JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,
    HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,
    HADOOP_MAPRED_HOME
  • 默认值:
    JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,
    HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,
    HADOOP_HOME,PATH,LANG,TZ

参数详解

  • MapReducer执行时,会在NodeManager上创建Container,在Container上执行Task(JAVA程序),该程序需要环境变量(如:JDK、HADOOP_MAPRED_HOME…)
  • 该参数就是 设置Container的能继承NodeManager的哪些环境变量

HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}_第1张图片

你可能感兴趣的:(Hadoop)