liveBook · Manning

replSetResizeOplog

As explained in MongoDB 8.0 in Action, Third Edition

replSetResizeOplog is a MongoDB administrative command that dynamically changes a replica-set member's oplog size.

replSetResizeOplog dynamically changes a replica-set member’s oplog size after initialization without restarting mongod. Use it when workload patterns consume more oplog space than the default allocation provides. section 9.1.3

Consider a larger oplog when operations create substantial replication history without comparable data growth:

  • Batch document updates can expand the oplog because idempotency requires separate logged actions. section 9.1.3
  • Balanced deletions and insertions can leave disk use stable while the oplog grows significantly. section 9.1.3
  • Frequent in-place updates can generate many oplog entries without enlarging stored documents. section 9.1.3
  • Size the oplog so secondaries can retrieve all entries generated during logical initial sync; otherwise entries may be purged too early. section 9.1.3
Listing 9.5 Output of the db.getReplicationInfo() command
db.getReplicationInfo()
{
  configuredLogSizeMB: 4096,
  logSizeMB: 4096,
  usedMB: 4074.63,
  timeDiff: 635133,
  timeDiffHours: 176.43,
  tFirst: 'Wed Mar 20 2024 10:44:15 GMT+0000 (Coordinated Universal Time)',
  tLast: 'Wed Mar 27 2024 19:09:48 GMT+0000 (Coordinated Universal Time)',
  now: 'Wed Mar 27 2024 19:09:49 GMT+0000 (Coordinated Universal Time)'
}

Inspect configured size, used space, and time window with db.getReplicationInfo() before deciding whether dynamic resizing is needed. section 9.1.3

How MongoDB 8.0 in Action, Third Edition covers it

How deep it goes
Explains dynamic resizing and retention rationale but omits command syntax, parameter details, and an execution walkthrough.
Examples
Uses batch updates, balanced deletions and insertions, in-place updates, and replication-information output as concrete sizing evidence.
What it assumes
Assumes familiarity with replica-set members, secondaries, oplog entries, and initial synchronization.
What you can do after
Operate/configure oplog capacity dynamically and evaluate whether its retention window can support secondary synchronization.
How it connects
Connects oplog sizing with replica sets, secondaries, logical initial sync, and minimum oplog retention.

This explainer was generated by Manning's knowledge graph from the text of MongoDB 8.0 in Action, Third Edition. The section links point to the parts of the book it draws on.