题面:
启动集群正常
运行 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