在EBS快照之前截断MongoDB oplog

and*_*ice 5 backup amazon-ec2 mongodb amazon-web-services

我目前有一个MongoDB(在AWS上)备份策略,其中涉及在一个节点上自动执行数据/日志卷的每日快照。该过程是:

  1. fsyncLock()
  2. 批量触发AWS快照(并等待成功)
  3. fsyncUnlock()

替换RS成员时,我从快照启动一个新实例并将其添加到副本集。我唯一遇到的问题是mongo进程启动时,新节点跳入SECONDARY并从另一个成员的oplog重播之前,存在很长的延迟(〜500GB数据需要20-30分钟)。我所看到的只是mongodb.log文件中的内容:

[initandlisten] Starting WiredTigerRecordStoreThread local.oplog.rs
[initandlisten] The size storer reports that the oplog contains 659681 records totaling to 4196461664 bytes
[initandlisten] Sampling from the oplog between Dec 20 05:29:14:2 and Jan 18 06:00:00:8 to determine where to place markers for truncation
[initandlisten] Taking 335 samples and assuming that each section of oplog contains approximately 19672 records totaling to 125140475 bytes
Run Code Online (Sandbox Code Playgroud)
  1. 蒙哥到底在这里做什么
  2. 除了确定MongoDB的上次optime何时启用(我已启用日记功能)之外,oplog在启动(从快照)时是否对MongoDB有用?
  3. 我可以通过截断操作日志中除最近条目以外的所有内容来进行补救吗?