微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

hadoop 执行 wordcount 出错 exit code 127 问题解决

题面:

启动集群正常

运行 wordcount 脚本时出现错误如下:

2021-03-06 10:46:36,826 INFO mapreduce.Job:  map 0% reduce 0%
2021-03-06 10:46:36,845 INFO mapreduce.Job: Job job_1614998747877_0001 Failed with state Failed due to: Application application_1614998747877_0001 Failed 2 times due to AM Container for appattempt_1614998747877_0001_000002 exited with  exitCode: 127
Failing this attempt.Diagnostics: [2021-03-06 10:46:36.605]Exception from container-launch.
Container id: container_1614998747877_0001_02_000001
Exit code: 127

[2021-03-06 10:46:36.645]Container exited with a non-zero exit code 127. Error file: prelaunch.err.
Last 4096 bytes of prelaunch.err :
Last 4096 bytes of stderr :
/bin/bash: /bin/java: No such file or directory


[2021-03-06 10:46:36.646]Container exited with a non-zero exit code 127. Error file: prelaunch.err.
Last 4096 bytes of prelaunch.err :
Last 4096 bytes of stderr :
/bin/bash: /bin/java: No such file or directory


For more detailed output, check the application tracking page: http://hadoop103:8088/cluster/app/application_1614998747877_0001 Then click on links to logs of each attempt.
. Failing the application.

在yarn网页中查看结果是:

Application application_1614998747877_0001 Failed 2 times due to AM Container for appattempt_1614998747877_0001_000002 exited with exitCode: 127
Failing this attempt.Diagnostics: [2021-03-06 10:46:36.605]Exception from container-launch.
Container id: container_1614998747877_0001_02_000001
Exit code: 127
[2021-03-06 10:46:36.645]Container exited with a non-zero exit code 127. Error file: prelaunch.err.
Last 4096 bytes of prelaunch.err :
Last 4096 bytes of stderr :
/bin/bash: /bin/java: No such file or directory
[2021-03-06 10:46:36.646]Container exited with a non-zero exit code 127. Error file: prelaunch.err.
Last 4096 bytes of prelaunch.err :
Last 4096 bytes of stderr :
/bin/bash: /bin/java: No such file or directory
For more detailed output, check the application tracking page: http://hadoop103:8088/cluster/app/application_1614998747877_0001 Then click on links to logs of each attempt.
. Failing the application.

解决

1.先把集群结束
#在资源调度服务器中
$HADOOP_HOME/sbin/stop-yarn.sh
#在NameNodez中
$HADOOP_HOME/sbin/stop-dfs.sh
2.修改 hadoop-env.sh 文件

下一步在 hadoop-env.sh 中配置 JAVA_HOME 环境

具体如下:

vim $HADOOP_HOME/eta/hadoop/hadoop-env.sh

加入代码

export JAVA_HOME=jdk安装根目录

我的是:

export JAVA_HOME=/opt/module/jdk1.8.0_212
3.xsync 同步到每个节点服务器上
4.重新启动集群

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐