[SERVER-2718] Can't add replica to set when it is not already in config Created: 09/Mar/11  Updated: 30/Mar/12  Resolved: 11/Mar/11

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

Type: Bug Priority: Major - P3
Reporter: Andrew Assignee: Kristina Chodorow (Inactive)
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-2717 --fastsync broken with RS Closed
Operating System: ALL
Participants:

 Description   

Start three nodes, add them to a replica set using the instructions on
http://www.mongodb.org/display/DOCS/Replica+Set+Tutorial

Now we follow these steps to add a new member from a backup:
http://www.mongodb.org/display/DOCS/Adding+a+New+Set+Member

But it doesn't go as well as the docs suggest. Here's what happens.

Create a new data directory /data/r3 and copy files from another mongod's data directory. Start up a new node using

mongod --replSet foo --port 27020 --dbpath /data/r3 --fastsync

This new mongod will log an error about not being in the replica set config. This error looks like (from Windows binary):

Tue Mar 08 22:39:15 [startReplSets] replSet error can't find self in the repl set configuration:
Tue Mar 08 22:39:15 [startReplSets] { _id: "foo", version: 1, members: [

{ _id: 0, host: "localhost:27017" }

,

{ _id: 1, host: "localhost:27018" }

,

{ _id: 2, host: "localhost:27019" }

] }
Tue Mar 08 22:39:15 [startReplSets] Assertion failure false db\repl\rs.cpp 336
Tue Mar 08 22:39:15 [startReplSets] replSet error loading configurations 0 assertion db\repl\rs.cpp:336
Tue Mar 08 22:39:15 [startReplSets] replSet error replication will not start
Tue Mar 08 22:39:15 [startReplSets] replSet error loading set config
Tue Mar 08 22:39:15 [startReplSets] replSet error fatal, stopping replication
Tue Mar 08 22:39:15 [startReplSets] replSet ~RSBase called
Tue Mar 08 22:39:15 [startReplSets] replSet caught exception in startReplSets thread: assertion db\repl\rs.cpp:336

Ok, well then maybe we just need to do rs.add("localhost:27020") from the master. Do that, restart the new mongod, it still fails with the same error. Now what?

Is the implication here that you can only restore from backups that include the new set member in the replica set config before taking the backup?



 Comments   
Comment by Andrew [ 09/Mar/11 ]

The only workaround I can find is to do the following:

== On the original master ==
1) rs.add("localhost:27020")

2) Copy the Javascript blob you get from rs.conf().

== Now on the new node ==
3) use local;
db.system.replset.update(

{"_id" : "foo"}

, <paste conf blob from master here>);

4) Restart the new node, it should now properly join the set.

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