今天发现储存在MongoDb GridFS里的图片错误,查看日志,发现类似下面的日志非常多:
Sat Mar 31 16:10:45 [conn42882] ns: fangdd.fs.chunks could not initialize cursor across all shards because : ns: mydb.fs.chunks ClusteredCursor::query @ shard2/192.168.222.201:10021,192.168.222.202:10024,192.168.222.202:10022,192.168.222.201:10023 attempt: 3
我水平比较低,只好使用 ps ax | grep mongo 找出每个mongo和mongos进程,一个个地kill -2 nnn,再启动。另外参与群集的服务器上也进行同时的操作。
重启完成后,发现较多如下错误:
Sat Mar 31 17:23:10 [Balancer] caught exception while doing balance: error checking clock skew of cluster 192.168.222.201:20000,192.168.222.201:2001ew of the cluster 192.168.222.201:20000,192.168.222.201:20010,192.168.222.202:20000 is too far out of bounds to allow distributed locking.
后来发现服务器的时间不完全一致,有台服务器慢了70多秒, 运行
sudo ntpdate stdtime.sinica.edu.tw 进行校时后,正常。
更权威的服务器: pool.ntp.org
复旦大学:ntp.fudan.edu.cn