环境:centos 6.0 mongodb2.4.13
1.集合分片后无法删除:
mongos> db.table.drop()
Tue Apr 21 18:40:30.943 drop failed: {
"code" : 14022,
"ok" : 0,
"errmsg" : "exception: Error locking distributed lock for chunk drop. :: caused by :: 13651 error checking clock skew of cluster 192.168.100.201:21000,192.168.100.202:21000,192.168.100.204:21000 :: caused by :: 13650 clock skew of the cluster 192.168.100.201:21000,192.168.100.202:21000,192.168.100.204:21000 is too far out of bounds to allow distributed locking."
} at src/mongo/shell/collection.js:383
原因:各主机时间不统一,修改统一ok。
与网络时间同步:
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime //修改时区
yum install -y ntpdate
ntpdate us.pool.ntp.org //同步时间
mongos> db.table.drop()
true
mongos>
2.mongos 集群无法启动
./mongos --configdb 192.168.100.201:21000,192.168.100.202:21000,192.168.100.204:21000 --port 20000 --logpath /data/mongodbtest/mongos/log/mongos.log --fork
about to fork child process, waiting until server is ready for connections.
forked process: 4394
ERROR: child process failed, exited with error number 1
查看日志如下:
error upgrading config database to v6 :: caused by :: DistributedClockSkewed clock skew of the cluster 192.168.100.201:21000,192.168.100.202:21000,
192.168.100.204:21000 is too far out of bounds to allow distributed locking.
原因:主机之间时钟有相差,约几百毫秒吧。重新同步ok。参照问题1。
./mongos --configdb 192.168.100.201:21000,192.168.100.202:21000,192.168.100.204:21000 --port 20000 --logpath /data/mongodbtest/mongos/log/mongos.log --fork
about to fork child process, waiting until server is ready for connections.
forked process: 5200
child process started successfully, parent exiting