Friday, 26 August 2016

How to create mongoDB oplog for single Mongo Shell node/instance using replica set

I am using MongoDB version 3.2.

MongoDB oplog  is mainly introduced for replication set or cluster of nodes.
**Oplog is created in local database in mongoDB server whenever we initialise a replica set.

Since replication is online process ( internet is needed ) I want to maintain central backup server offline for my project.So I do not need  replica set.(so I do not want to use it).
Hence I am exploring an option to create oplog without initializing  replica set.

But I could not generate oplog just by opening a mongoDB shell (node).
Oplog is not found under local db.


My solution  is -->
1. run mongod as
mongod --replSet rs0

2.open mongoDB shell(node) and initialize it.
 rs.initialise();

That's it !!! Do not add any other members to replica set.
(It is equivalent to single mongoDB node)

3.Now add record to your created db for project
and check oplog.


 Please comment if anyone has an alternative solution to this.
May we can open multiple mongoDB nodes/instances on same server and make every node as primary?
But How to make each node primary without being part of replica set?








No comments:

Post a Comment