mongo-集群主机的时钟同步

在mongo集群中,各个主机的时间需要一致,否则可能会提示错误。

例如我的3台主机,其中一台超前了约2分钟,创建集合时没问题,但删除时提示如下错误:

> db.csptest2.drop()
Fri Feb 22 08:48:24 uncaught exception: drop failed: {
"errmsg" : "exception: Error locking distributed lock for chunk drop. :: caused by :: 13651 error checking clock skew of cluster 10.0.0.1:39000,10.0.0.2:39000,10.0.0.3:39000 :: caused by :: 13650 clock skew of the cluster 10.0.0.1:39000,10.0.0.2:39000,10.0.0.3:39000 is too far out of bounds to allow distributed locking.",
"code" : 14022,
"ok" : 0
}

将这台主机调整到和其他主机相差在十几秒后,即可执行成功:
> db.csptest2.drop()
true
>

 

 

 

 

 

 

 

posted @ 2013-02-22 08:59  醇酒醉影  阅读(1121)  评论(0编辑  收藏  举报