133
mongodb
runtime_error
ai_generated
partial
MongoServerError: OplogStartMissing: no oplog entry found for timestamp
ID: mongodb/oplog-too-small-for-replication
85%Fix Rate
87%Confidence
1Evidence
2024-03-05First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| mongodb 7.0 | active | — | — | — |
| mongodb 6.0 | active | — | — | — |
| mongodb 5.0 | active | — | — | — |
| mongodb 4.4 | active | — | — | — |
Root Cause
The secondary replica set member fell too far behind and the primary's oplog has already rolled over the required entry.
generic中文
副本集从节点落后太多,主节点的操作日志已覆盖所需条目。
Official Documentation
https://www.mongodb.com/docs/manual/tutorial/resync-replica-set-member/Workarounds
-
95% success Resync the secondary by deleting its data directory and restarting: rm -rf /var/lib/mongodb/* && systemctl restart mongod
Resync the secondary by deleting its data directory and restarting: rm -rf /var/lib/mongodb/* && systemctl restart mongod
-
80% success Increase the primary's oplog size to prevent future gaps: db.adminCommand({ replSetResizeOplog: 1, size: 40960 }) (set to 40GB)
Increase the primary's oplog size to prevent future gaps: db.adminCommand({ replSetResizeOplog: 1, size: 40960 }) (set to 40GB)
中文步骤
通过删除从节点的数据目录并重启来重新同步:rm -rf /var/lib/mongodb/* && systemctl restart mongod
增加主节点的操作日志大小以防止未来差距:db.adminCommand({ replSetResizeOplog: 1, size: 40960 })(设置为40GB)
Dead Ends
Common approaches that don't work:
-
90% fail
The oplog gap remains; the secondary will still fail to sync.
-
95% fail
Oplog size is set on the primary; secondary can't modify it.