问题
执行wordcount例子程序,出现以下错误:
18/08/18 22:40:43 INFO client.RMProxy: Connecting to ResourceManager at admin1/192.168.1.21:8032
18/08/18 22:40:44 WARN mapreduce.JobResourceUploader: Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this.
18/08/18 22:40:44 INFO input.FileInputFormat: Total input paths to process : 1
18/08/18 22:40:44 INFO mapreduce.JobSubmitter: number of splits:1
18/08/18 22:40:44 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1534515316138_0003
18/08/18 22:40:45 INFO impl.YarnClientImpl: Submitted application application_1534515316138_0003
18/08/18 22:40:45 INFO mapreduce.Job: The url to track the job: http://admin1:8088/proxy/application_1534515316138_0003/
18/08/18 22:40:45 INFO mapreduce.Job: Running job: job_1534515316138_0003
18/08/18 22:40:53 INFO mapreduce.Job: Job job_1534515316138_0003 running in uber mode : false
18/08/18 22:40:53 INFO mapreduce.Job: map 0% reduce 0%
18/08/18 22:40:55 INFO mapreduce.Job: Task Id : attempt_1534515316138_0003_m_000000_0, Status : FAILED
Container launch failed for container_1534515316138_0003_01_000002 : org.apache.hadoop.yarn.exceptions.YarnException: Unauthorized request to start container.
This token is expired. current time is 1534603254297 found 1534517454172
Note: System times on machines may be out of sync. Check system time and time zones.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.yarn.api.records.impl.pb.SerializedExceptionPBImpl.instantiateException(SerializedExceptionPBImpl.java:168)
at org.apache.hadoop.yarn.api.records.impl.pb.SerializedExceptionPBImpl.deSerialize(SerializedExceptionPBImpl.java:106)
at org.apache.hadoop.mapreduce.v2.app.launcher.ContainerLauncherImpl$Container.launch(ContainerLauncherImpl.java:155)
at org.apache.hadoop.mapreduce.v2.app.launcher.ContainerLauncherImpl$EventProcessor.run(ContainerLauncherImpl.java:369)
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)
分析原因
这是因为datanode与namenode之间未设置时间同步,所以才会引起该异常。
解决方法
将多个datanode与namenode之间进行时间同步。
使用date命令:
date :查看当前时间,结果如下:
2018年 08月 18日 星期六 22:36:09 CST
通过使用命令date -s 22:40:00
来设置当前时间,结果如下:
2018年 08月 18日 星期六 22:40:00 CST
ntpdate命令:ntpdate -u 210.72.145.44
:网络时间同步命令
还有一种情况就是如果之前设置了同步时间,同步时间的服务也是正常运行,但是还是出现上述的这种情况只能重启下同步时间的服务,问题搞定!