133 mongodb runtime_error ai_generated partial

MongoServerError:OplogStartMissing:未找到时间戳的操作日志条目

MongoServerError: OplogStartMissing: no oplog entry found for timestamp

ID: mongodb/oplog-too-small-for-replication

其他格式: JSON · Markdown 中文 · English
85%修复率
87%置信度
1证据数
2024-03-05首次发现

版本兼容性

版本状态引入弃用备注
mongodb 7.0 active — — —
mongodb 6.0 active — — —
mongodb 5.0 active — — —
mongodb 4.4 active — — —

根因分析

副本集从节点落后太多,主节点的操作日志已覆盖所需条目。

English

The secondary replica set member fell too far behind and the primary's oplog has already rolled over the required entry.

generic

官方文档

https://www.mongodb.com/docs/manual/tutorial/resync-replica-set-member/

解决方案

  1. 通过删除从节点的数据目录并重启来重新同步:rm -rf /var/lib/mongodb/* && systemctl restart mongod
  2. 增加主节点的操作日志大小以防止未来差距:db.adminCommand({ replSetResizeOplog: 1, size: 40960 })(设置为40GB)

无效尝试

常见但无效的做法:

  1. 90% 失败

    The oplog gap remains; the secondary will still fail to sync.

  2. 95% 失败

    Oplog size is set on the primary; secondary can't modify it.