由于AM容器,应用程序失败了2次:退出,退出时使用exitCode:1

Erf*_*ngy 16 hadoop mapreduce

我在hadoop-2.7.0上运行了mapreduce作业,但mapreduce作业无法启动,我遇到了这个波纹错误:

Job job_1491779488590_0002 failed with state FAILED due to: Application application_1491779488590_0002 failed 2 times due to AM Container for appattempt_1491779488590_0002_000002 exited with  exitCode: 1
For more detailed output, check application tracking page:http://erfan:8088/cluster/app/application_1491779488590_0002Then, click on links to logs of each attempt.
Diagnostics: Exception from container-launch.
Container id: container_1491779488590_0002_02_000001
Exit code: 1
Stack trace: ExitCodeException exitCode=1: 
    at org.apache.hadoop.util.Shell.runCommand(Shell.java:545)
    at org.apache.hadoop.util.Shell.run(Shell.java:456)
    at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:722)
    at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:211)
    at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:302)
    at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:82)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)


Container exited with a non-zero exit code 1
Failing this attempt. Failing the application.
17/04/10 13:40:08 INFO mapreduce.Job: Counters: 0
Run Code Online (Sandbox Code Playgroud)

这个错误的原因是什么,我该如何解决这个问题?

任何帮助赞赏.

小智 8

检查资源管理器上的日志:

你有这个错误: 在此处输入图片说明

现在打开终端并检查实际问题:

yarn logs -applicationId <APP_ID>
Run Code Online (Sandbox Code Playgroud)

示例:APP_ID = application_1535002188113_0001

在我的情况下,它显示权限问题:

所以我给了它:

   sudo -u hdfs hadoop fs -chmod 775 /user/history
   
   or
   
   sudo -u hdfs hadoop fs -chmod 777 /user/history
Run Code Online (Sandbox Code Playgroud)


小智 5

您可以查看实际问题的应用程序日志。

为此,您可以在上打开namenode Web界面。在 namenode_ip:50070
这里您可以看到浏览选项,单击它。
在子菜单中,选择日志。
现在选择用户日志。

在这里,您可以看到您运行的应用程序列表。

打开application_1491779488590_0002您上面提到的作业的链接,您可以在其中看到每个map&reduce任务的日志。打开地图/减少作业日志链接。

在其中可以看到:sys,错误,stdout文件。从这些日志文件中,您可以获取实际的错误并可以对其进行修复。

或者您在$HADOOP_HOME/logs/userlogs/application_id 路径中看到这些日志 。

应用程序失败了两次,因为如果应用程序主控由于某种原因失败,则默认情况下它将尝试再次执行该应用程序。可以将AM retry属性设置为1以避免这种情况。