Hadoop 伪分布式环境, jobhistory 配置信息引起的报错

时间:2024-05-20 14:09:02

Hadoop 版本 2.6.5 Ubuntu Linux 伪分布式环境

之前我的Hadoop环境因为运行时报了下面的错误:

ava.io.IOException: java.net.ConnectException: Call From localhost.localdomain/127.0.0.1 to 0.0.0.0:10020 failed on connection exception: java.net.ConnectException

  

经过定位发现是jobhistory 服务没有启动导致。

  

然后我就配置了jobhistory 服务的信息,具体方式如下:

首先,打开mapred-site.xml,加入下图里面的配置。

Hadoop 伪分布式环境, jobhistory 配置信息引起的报错

  

然后启动了jobhistory 服务。 可是,接下来更加闹心的是引入了一个新的错误:

  

For more detailed output, check application tracking page:http://localhost.localdomain:8088/proxy/application_1523436431838_0008/Then, click on links to logs of each attempt.

Diagnostics: Exception from container-launch.

Container id: container_1523436431838_0008_02_000001

Exit code: 1

Stack trace: ExitCodeException exitCode=1:

at org.apache.hadoop.util.Shell.runCommand(Shell.java:575)

at org.apache.hadoop.util.Shell.run(Shell.java:478)

at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:766)

at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:212)

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:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

  

然后我找相关的内容,发现网上很难找到对症的解决方案。接下来我查看job运行的日志,发现更加底层的错误其实是:

  

2018-04-11 17:25:47,062 INFO [Thread-70] org.apache.hadoop.mapreduce.v2.app.rm.RMContainerAllocator: Setting job diagnostics to

2018-04-11 17:25:47,090 ERROR [Thread-70] org.apache.hadoop.mapreduce.v2.app.rm.RMContainerAllocator: Exception while unregistering

java.lang.NullPointerException

at org.apache.hadoop.mapreduce.v2.util.MRWebAppUtil.getApplicationWebURLOnJHSWithoutScheme(MRWebAppUtil.java:140)

at org.apache.hadoop.mapreduce.v2.util.MRWebAppUtil.getApplicationWebURLOnJHSWithScheme(MRWebAppUtil.java:155)

at org.apache.hadoop.mapreduce.v2.app.rm.RMCommunicator.doUnregistration(RMCommunicator.java:219)

at org.apache.hadoop.mapreduce.v2.app.rm.RMCommunicator.unregister(RMCommunicator.java:189)

at org.apache.hadoop.mapreduce.v2.app.rm.RMCommunicator.serviceStop(RMCommunicator.java:269)

at org.apache.hadoop.mapreduce.v2.app.rm.RMContainerAllocator.serviceStop(RMContainerAllocator.java:291)

at org.apache.hadoop.service.AbstractService.stop(AbstractService.java:221)

at org.apache.hadoop.service.ServiceOperations.stop(ServiceOperations.java:52)

at org.apache.hadoop.mapreduce.v2.app.MRAppMaster$ContainerAllocatorRouter.serviceStop(MRAppMaster.java:825)

at org.apache.hadoop.service.AbstractService.stop(AbstractService.java:221)

at org.apache.hadoop.service.ServiceOperations.stop(ServiceOperations.java:52)

at org.apache.hadoop.service.ServiceOperations.stopQuietly(ServiceOperations.java:80)

at org.apache.hadoop.service.CompositeService.stop(CompositeService.java:157)

at org.apache.hadoop.service.CompositeService.serviceStop(CompositeService.java:131)

at org.apache.hadoop.mapreduce.v2.app.MRAppMaster.serviceStop(MRAppMaster.java:1607)

at org.apache.hadoop.service.AbstractService.stop(AbstractService.java:221)

at org.apache.hadoop.mapreduce.v2.app.MRAppMaster.stop(MRAppMaster.java:1103)

at org.apache.hadoop.mapreduce.v2.app.MRAppMaster.shutDownJob(MRAppMaster.java:555)

at org.apache.hadoop.mapreduce.v2.app.MRAppMaster$JobFinishEventHandler$1.run(MRAppMaster.java:602)

2018-04-11 17:25:47,107 INFO [Thread-70] org.apache.hadoop.mapreduce.v2.app.rm.RMContainerAllocator: Final Stats: PendingReds:0 ScheduledMaps:0 ScheduledReds:0 AssignedMaps:0 AssignedReds:0 CompletedMaps:1 CompletedReds:1 ContAlloc:2 ContRel:0 HostLocal:1 RackLocal:0

  

  

所以我就找这个错误相关的原因和解决方案,最后找到了一个Apache官方的答案:https://issues.apache.org/jira/browse/MAPREDUCE-5721

  

这个链接中告诉我其实错误的原因是jobhistory的 mapreduce.jobhistory.address 参数配置有问题引起的。

  

Hadoop 伪分布式环境, jobhistory 配置信息引起的报错

  

确定了这点之后,我直接注解掉了jobhistory 的配置信息,然后直接使用Hadoop默认的配置,重新启动 jobhistory 服务,然后再次执行mapreduce 任务,发现这次成功的执行完了,没有报错。