mongodb - 复制集中的mongodb节点是否需要时间同步?

标签 mongodb replication

“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/

相关文章:

c# - 使用 C# 获取和添加/更新多级嵌入/嵌套 MongoDB 文档

couchdb - 如何仅为某些用户和角色显示和复制文档?

replication - Citus 分片、复制和复制

node.js - 使用 PostgreSQL 在 2 个独立的数据中心同步 2 个 NodeJS 实例

mysql - 跟踪用户事件日志 - SQL 与 NoSQL?

mongodb - 蒙哥 : count the number of word occurrences in a set of documents

ruby-on-rails - Mongoid 和 has_and_belongs_to_many 关联

java - 指定字段对于 MongoDB 是 transient 的,但对于 RestController 不是

java - 使用 RMI EhCache 数据的复制缓存未加载到所有 Tomcat 实例中

elasticsearch - 复制 Elasticsearch 主分片