Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1058

Force replSetReconfig in mongodb C# driver

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Blocker - P1 Blocker - P1
    • None
    • Affects Version/s: None
    • Component/s: API, BSON, Configuration
    • Labels:

      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?

            Assignee:
            Unassigned Unassigned
            Reporter:
            stephenw Stephen Weaver
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: