“MongoDB in Action”一书说:
Imagine you issue a write to the primary node of a replica set. What happens next? First, the write is recorded and then added to the primary’s oplog. Meanwhile, all sec- ondaries have their own oplogs that replicate the primary’s oplog. So when a given secondary node is ready to update itself, it does three things. First, it looks at the time- stamp of the latest entry in its own oplog. Next, it queries the primary’s oplog for all entries greater than that timestamp. Finally, it adds each of those entries to its own oplog and applies the entries to itself
所以这意味着节点必须是时间同步的?因为所有节点上的时间戳必须相等。
最佳答案
一般来说,是的,让您的主机同步是一个非常好的主意(NTP 是通常的解决方案)。事实上,我见过比不同步 oplog 更严重的问题 - 集群中数据库主机上的不同时间应该被认为是必须的。
这实际上在文档的生产说明页面上提到了:
http://www.mongodb.org/display/DOCS/Production+Notes#ProductionNotes-Linux
请参阅有关最小化时钟偏差的注释。
关于mongodb - 复制集中的mongodb节点是否需要时间同步?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10068761/