1.

{ "_id" : 1, "x" : 1, "y" : 2 }{ "_id" : 2, "x" : 2, "y" : 4 }{ "_id" : 3, "x" : 3, "y" : 7 }{ "_id" : 4, "x" : 4, "y" : 10 }{ "_id" : 5, "x" : 5, "y" : 75 }

Answer»

The oplog is operation logs that keep an update of all operations that modify the data stored in databases. We can define the oplog size while starting MONGODB by specifying the --oplog option. If we do not specify this option it will take the default values which is 5% of physical memory in case of wiredTiger. While the default value is sufficient for most workloads in some cases we may need to change the oplog size for the replica set.

OPlog size is CHANGED in a ROLLING manner, first, we change on all secondary and then a primary member of the replica set. To change oplog size

  • First we need to CONNECT to any secondary member.
  • Verify the size of current oplog by running below command on the local database.

use local

db.oplog.rs.stats().maxSize
  • Change the oplog size using ADMIN command replSetResizeOplog specifying a new size for oplog.
db.adminCommand({replSetResizeOplog: 1, size: "Size-in-MB"})
  • Repeat the same process for other secondary members and then on the primary member of the replica set.


Discussion

No Comment Found