MongoDb不能同步,可能是伺服器時間不一致

來源:互聯網
上載者:User

今天發現儲存在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 進行校時後,正常。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.