I am running mongod as standalone server .now i want to enable oplog for it ,i want to know whether it is possible or not ?
I knew I can do this by creating single node ReplicaSet ,but I want to do this without replica set .
Risks with the oplog are related to its being capped: if your oplog is too small, any maintenance operations that require you to take down a replica can cause the copy to fail.
MongoDB stores information about changes to the database in a local capped collection called an Oplog. The Oplog contains information about changes in data as well as changes in the database. The MongoDB Oplog origin can read any operation written to the Oplog.
I got a reply from the MongoDb Team, and it's working fine.
To enable oplog
on a standalone server, start mongo
with master
options.
On command line start mongod --master
.
For conf file append the following line:
master=true
More details here.
For mongo 2.6 or greater the /etc/mongod.conf now uses a yaml format.
To enable the oplog add something similar to the below, note the replication:
line may already exist, be sure to use spaces.
replication:
replSetName: rs0
oplogSizeMB: 100
Full documentation here: https://docs.mongodb.com/manual/reference/configuration-options/#replication-options
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With