環境: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 ntpdatentpdate us.pool.ntp.org //同步時間mongos> db.table.drop()truemongos>
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 --forkabout to fork child process, waiting until server is ready for connections.forked process: 4394ERROR: 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 --forkabout to fork child process, waiting until server is ready for connections.forked process: 5200child process started successfully, parent exiting