[CSHARP-1058] Force replSetReconfig in mongodb C# driver Created: 08/Sep/14  Updated: 05/Apr/19  Resolved: 04/Apr/15

Status: Closed
Project: C# Driver
Component/s: API, BSON, Configuration
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Blocker - P1
Reporter: Stephen Weaver Assignee: Unassigned
Resolution: Done Votes: 0
Labels: c#, question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I've been on forums talking with several people for the last few days and no one has been able to give me an answer.

Is there anyway to reconfigure a replica set in the event the primary as well as a majority of the servers are down? For example if data center 1 goes down, a procedure can be run to reconfigure and set a new primary with the remaining servers?

I tried the eval method on the database object and I get this:
"Command '$eval' failed: not master (response:

{ "note" : "from execCommand", "ok" : 0.0, "errmsg" : "not master" }

)"

I also tried this:
var reconfigCommand = new CommandDocument
{
{"replSetReconfig", new BsonDocument{{"configuration", newConfig},

{"force", true}

}}
};

var response = database.RunCommand(reconfigCommand);

And RunCommand throws the following MongoCommandException

Command 'replSetReconfig' failed: replSetReconfig command must be sent to the current replica set primary. (response:

{ "ok" : 0.0, "errmsg" : "replSetReconfig command must be sent to the current replica set primary." }

)

From what I can tell in the documentation, force = true should allow reconfig against a non-primary database.

Any suggestions?


Generated at Wed Feb 07 21:38:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.