[SERVER-6294] Replicate Set setup error message: "local.oplog.rs is not empty on the initiating member. cannot initiate" Created: 03/Jul/12  Updated: 15/Feb/13  Resolved: 27/Aug/12

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Eugene Shustef Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 2008 Server R2


Participants:

 Description   

We have a Mongo node running and we want to add a secondary and an arbiter. Current node will be our Primary. All three are up and running and have the exact same configuration. When we try to run rs.initiate(), we get "local.oplog.rs is not empty on the initiating member. cannot initiate" error. There is data in the local.oplog.rs collection on the primary. It's most likely got there during our original attempt to stand up the replica set. At that time if brought out primary down to its knees and we stopped. Since then, we copied most of the current data to the secondary. We were expecting for the nodes to come up and then for the secondary to balance the deltas. Should we just delete the contents of "local.oplog.rs"? Can we just drop it?



 Comments   
Comment by A. Jesse Jiryu Davis [ 17/Aug/12 ]

Presuming you have no collections you care about in 'local', that you have only the oplog or you have nothing in 'local', then it is safe to remove 'local' according to Eliot's instructions above.

To reiterate, as Eliot says, a new MongoDB secondary must be empty when added to a replica set; Mongo does not sync deltas the way that, for example, rsync does.

Comment by Menny Even Danan [ 05/Jul/12 ]

I have an operational mongoDB, and I'm trying to upgrade to replicaset. Get the same error you did.
My question is, is it safe (data-wise) to remove the local DB?

Comment by Eliot Horowitz (Inactive) [ 05/Jul/12 ]

Without an oplog, there is no way to sync just the deltas as we don't know where to start.

Comment by Eugene Shustef [ 04/Jul/12 ]

That worked. Another question if I may. We originally restored the secondary db from the mongodump from the primary thinking that upon startup the secondary will only sync deltas. It appears to just wipe out the current contents and rsync from scratch. Is there no way to just sync the deltas? The initial rsync is killing the primary server.

Thanks!

Comment by Eliot Horowitz (Inactive) [ 03/Jul/12 ]

Is there a config on the node you want to be primary?
If not, you should:
shutdown
remove local.*
restart
initiate
add other members

Generated at Thu Feb 08 03:11:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.