Wednesday, 31 August 2016

How to create oplog for MongoDB without using replica set

I am using MongoDb version 3.2

Normally replica set is used to generate oplog in MongoDB.

I have a requirement wherein I need every mongoDB instance running on different servers as Master or Primary.

Therefore I got the below solution ->
In version 3.2 each mongoDB instance is connected as Master(Primary) if we do not use replica set. But  this will not generate oplog in local database and hence no Oplog Tail is available.

We need at least 1 master user for oplog generation.(In Replica set 1 user as Master is mandatory.)

1. Run mongod instance as master.
 mongod --master
2.Now run mongo node and connect to local database.
use local;

You will find oplog.$main collection as oplog connection.



No comments:

Post a Comment