How to setup an oplog on a single MongoDB instance
13 Jun 2014The MongoDB oplog allows you to keep track of changes that have happened on your database in real-time. This is a very useful tool that isn’t offered out of the box with a single server instance. You can follow these steps to enable to oplog on a standalone MongoDB instance.
Un-comment the following lines from your /etc/mongodb.conf
file
This will give your MongoDB server a replica set identity of rs0
and will allow your oplog to grow to 1024mb. You can tune these parameters to suit.
To complete the process, restart your MongoDB daemon and open a shell. You just need to issue rs.initiate()
on the local
database:
You now have the oplog available to you.