Professional Documents
Culture Documents
Oplog in Standalone System: /etc/mongod - Conf
Oplog in Standalone System: /etc/mongod - Conf
Oplog is used primarily for replication and is not available in standalone MongoDB instances by default.
However, if we still want to enable the oplog on a standalone MongoDB instance, we can run it as a single-
member replica set. This essentially converts your standalone instance into a replica set with just one node.
2. Edit the MongoDB configuration file /etc/mongod.conf and Add the following settings to enable the
replica set and define the oplog size:
replication:
replSetName: rs0
oplogSizeMB: <desired_oplog_size_in_MB>
Replace <desired_oplog_size_in_MB> with the size you want for the oplog (e.g., 1024 for 1 GB). The
optimal size depends on your write operation rate and how much history you want to retain.
Once edited the /etc/mongod.conf save and restart the mongod instance to apply the settings.