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

本文详细解析了在Hadoop 3.13 YARN环境中遇到的MapReduce任务执行错误,重点介绍了`MRAppMaster`加载失败和配置`yarn-site.xml`的解决方案,包括环境变量设置和`yarn.nodemanager.env-whitelist`的调整。

场景

在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
User: root Name: SELECT COUNT(*) FROM comm.ods_behavior_log (Stage-1) Application Type: MAPREDUCE Application Tags: Application Priority: 0 (Higher Integer value indicates higher priority) YarnApplicationState: FAILED Queue: default FinalStatus Reported by AM: FAILED Started: Fri Aug 08 18:20:27 -0700 2025 Launched: Fri Aug 08 18:23:29 -0700 2025 Finished: Fri Aug 08 18:23:32 -0700 2025 Elapsed: 3mins, 5sec Tracking URL: History Log Aggregation Status: DISABLED Application Timeout (Remaining Time): Unlimited Diagnostics: Application application_1754666554161_0012 failed 2 times due to AM Container for appattempt_1754666554161_0012_000002 exited with exitCode: 1 Failing this attempt.Diagnostics: [2025-08-08 18:23:32.638]Exception from container-launch. Container id: container_1754666554161_0012_02_000001 Exit code: 1 [2025-08-08 18:23:32.640]Container exited with a non-zero exit code 1. Error file: prelaunch.err. Last 4096 bytes of prelaunch.err : Last 4096 bytes of stderr : Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster Please check whether your <HADOOP_HOME>/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> [2025-08-08 18:23:32.642]Container exited with a non-zero exit code 1. Error file: prelaunch.err. Last 4096 bytes of prelaunch.err : Last 4096 bytes of stderr : Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster Please check whether your <HADOOP_HOME>/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> For more detailed output, check the application tracking page: http://master:8088/cluster/app/application_1754666554161_0012 Then click on links to logs of each attempt. . Failing the application. Unmanaged Application: false Application Node Label expression: <Not set> AM container Node Label expression: <DEFAULT_PARTITION> Application Metrics Total Resource Preempted: <memory:0, vCores:0> Total Number of Non-AM Containers Preempted: 0 Total Number of AM Containers Preempted: 0 Resource Preempted from Current Attempt: <memory:0, vCores:0> Number of Non-AM Containers Preempted from Current Attempt: 0 Aggregate Resource Allocation: 377650 MB-seconds, 184 vcore-seconds Aggregate Preempted Resource Allocation: 0 MB-seconds, 0 vcore-seconds Show 20 entriesSearch: Attempt ID Started Node Logs Nodes blacklisted by the app Nodes blacklisted by the system appattempt_1754666554161_0012_000002 Sat Aug 9 09:23:29 +0800 2025 http://master:8042 Logs 0 0 appattempt_1754666554161_0012_000001 Sat Aug 9 09:20:27 +0800 2025 http://slave1:8042 Logs 0 0
08-10
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小基基o_O

您的鼓励是我创作的巨大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值