Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

oplog enable on standalone mongod not for replicaset

Tags:

mongodb

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 .

like image 774
Rajnish Avatar asked Dec 10 '13 05:12

Rajnish


People also ask

What is the risk of having a small Oplog?

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.

How does Oplog work in MongoDB?

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.


2 Answers

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.

like image 59
Rajnish Avatar answered Sep 30 '22 00:09

Rajnish


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

like image 31
TechplexEngineer Avatar answered Sep 30 '22 00:09

TechplexEngineer