首页 > 代码库 > Hbase时间同步

Hbase时间同步

 如果Hbase的时间没有同步,启动主节点会起来,子节点的regionServer就不会起来。

错误日志如下:

aused by: org.apache.hadoop.hbase.ipc.RemoteWithExtrasException(org.apache.hadoop.hbase.ClockOutOfSyncException): org.apache.hadoop.hbase.ClockOutOfSyncException:
Server slave1,60020,1398673427650 has been rejected; Reported time is too far out of sync with master. Time difference of 43201045ms > max allowed of 180000ms
at org.apache.hadoop.hbase.master.ServerManager.checkClockSkew(ServerManager.java:316)
at org.apache.hadoop.hbase.master.ServerManager.regionServerStartup(ServerManager.java:216)
at org.apache.hadoop.hbase.master.HMaster.regionServerStartup(HMaster.java:1281)
at org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos$RegionServerStatusService$2.callBlockingMethod(RegionServerStatusProtos.java:5085)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2008)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:92)
at org.apache.hadoop.hbase.ipc.FifoRpcScheduler$1.run(FifoRpcScheduler.java:73)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
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:744)

at org.apache.hadoop.hbase.ipc.RpcClient.call(RpcClient.java:1445)
at org.apache.hadoop.hbase.ipc.RpcClient.callBlockingMethod(RpcClient.java:1649)
at org.apache.hadoop.hbase.ipc.RpcClient$BlockingRpcChannelImplementation.callBlockingMethod(RpcClient.java:1707)
at org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos$RegionServerStatusService$BlockingStub.regionServerStartup(RegionServerStatusProtos.
java:5402)
at org.apache.hadoop.hbase.regionserver.HRegionServer.reportForDuty(HRegionServer.java:1996)
... 2 more
2014-04-28 16:23:50,134 FATAL [regionserver60020] regionserver.HRegionServer: RegionServer abort: loaded coprocessors are: []
2014-04-28 16:23:50,134 INFO [regionserver60020] regionserver.HRegionServer: STOPPED: Unhandled: org.apache.hadoop.hbase.ClockOutOfSyncException: Server slave1,60
020,1398673427650 has been rejected; Reported time is too far out of sync with master. Time difference of 43201045ms > max allowed of 180000ms
at org.apache.hadoop.hbase.master.ServerManager.checkClockSkew(ServerManager.java:316)
at org.apache.hadoop.hbase.master.ServerManager.regionServerStartup(ServerManager.java:216)
at org.apache.hadoop.hbase.master.HMaster.regionServerStartup(HMaster.java:1281)
at org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos$RegionServerStatusService$2.callBlockingMethod(RegionServerStatusProtos.java:5085)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2008)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:92)
at org.apache.hadoop.hbase.ipc.FifoRpcScheduler$1.run(FifoRpcScheduler.java:73)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
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:744)

2014-04-28 16:23:50,134 INFO [regionserver60020] ipc.RpcServer: Stopping server on 60020
2014-04-28 16:23:50,136 INFO [regionserver60020] regionserver.HRegionServer: Stopping infoServer
2014-04-28 16:23:50,138 INFO [regionserver60020] mortbay.log: Stopped SelectChannelConnector@0.0.0.0:60030
2014-04-28 16:23:50,239 INFO [regionserver60020] snapshot.RegionServerSnapshotManager: Stopping RegionServerSnapshotManager abruptly.
2014-04-28 16:23:50,239 INFO [regionserver60020] regionserver.HRegionServer: aborting server null

解决办法:(前提是服务器可以连外网)用root的用户登录后执行,

ntpdate asia.pool.ntp.org   会出现:28 Apr 16:30:54 ntpdate[20064]: step time server 211.233.84.186 offset -43201.010661 sec

然后在主节点启动hbase服务即可。