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.重新啟動集群


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM