报错信息:
2023-12-19 14:28:25,893 INFO mapreduce.Job: Job job_1702967272525_0001 failed with state FAILED due to: Application application_1702967272525_0001 failed 2 times due to AM Container for appattempt_1702967272525_0001_000002 exited with exitCode: 127
Failing this attempt.Diagnostics: [2023-12-19 14:28:25.741]Exception from container-launch.
Container id: container_1702967272525_0001_02_000001
Exit code: 127
[2023-12-19 14:28:25.784]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
[2023-12-19 14:28:25.785]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
问题分析:
从报错信息字面上看是找不到java执行目录,但是我在hadoop-env.sh yarn-env.sh等配置文件中已经配置好了java的环境变量。接着想到既然说找不到/bin/java,那就直接把安装的jdk目录下的/bin/java执行文件直接链接到/bin/java
解决方案:
在hadoop集群的各节点都执行命令ln -s /usr/local/jdk/jdk1.8.0_161/bin/java /bin/java
其中/usr/local/jdk/jdk1.8.0_161/为你的jdk安装目录,也就是配置到环境变量中的JAVA_HOME的路径