You are on page 1of 1

Oplog in Standalone System

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.

Here’s how to enable oplog on a standalone MongoDB instance:

1. Stop your running MongoDB instance if it’s currently running.

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.

You might also like