New in version 3.6.
replSetResizeOplogadministrative command to change the size of a replica set member’s oplog.
replSetResizeOplogenables you to resize the oplog dynamically without restarting the
You must run this command against the
The command has the following form:
replSetResizeOplogtakes the size parameter in megabytes while the oplog size is stored in bytes:
- The minimum size you can specify is 990 megabytes.
- The maximum size you can specify is 1 petabytes.
Changing the oplog size of a given replica set member with
replSetResizeOplog does not change the oplog size of any other member in the replica set. You must run
replSetResizeOplog on each replica set member in your cluster to change the oplog size for all members.
Reducing the oplog size does not reclaim that disk space automatically. You must run
compact against the
oplog.rs collection in the
compact blocks all operations on the database it runs against. Running
oplog.rs therefore prevents oplog synchronization. For a procedure on resizing the oplog and compacting
oplog.rs, see Change the Size of the Oplog.
stats command to display the current oplog size,
maxSize. For example:
The above command will return the oplog size of this member:
maxSize is currently 9790804377 bytes, or 9337 megabytes.
The following command changes the oplog size of this member to 17179869184 bytes, or 16384 megabytes.
To change the size, run the
replSetResizeOplog, passing the desired size in megabytes as a parameter.
To verify the new oplog size, rerun the
The above command returns:
Reducing the size of the oplog in a node removes data from it. This may cause replica members syncing with that node to become stale. To resync those members, see Resync a Member of a Replica Set.