当我在hadoop2.6.4上运行MR程序时,发生了如下错误:
org.apache.hadoop.yarn.exceptions.YarnException: Unauthorized request to start container.
内容:
18/07/23 10:49:30 INFO mapreduce.Job: Task Id : attempt_1532301779475_0009_r_000000_1000, Status : FAILED
Container launch failed for container_1532301779475_0009_02_000003 : org.apache.hadoop.yarn.exceptions.YarnException: Unauthorized request to start container.
This token is expired. current time is 1532314168852 found 1532309369785
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的时间不同步导致的
解决办法:
#crontab -e
编辑:
0 1 * * * /usr/sbin/ntpdate cn.pool.ntp.org
wq保存
#/usr/sbin/ntpdate cn.pool.ntp.org
报错:……the NTP socket is in use, exiting
(停止服务)
# service ntpd stop
(设置开机不启动)
# chkconfig ntpd off
然后执行:
# /usr/sbin/ntpdate cn.pool.ntp.org
成功:
adjust time server 5.79.108.34 offset -0.001357 sec
即时生效暴力方法:
# date -s 00:00:00