0

Say, I have set write concern for a replica set with 3 members as w = "majority". If a member of the replica set goes down, would it be possible that the write concern could change for such a scenario?

I read MongoDB: The definitive guide as well as read the MongoDB documentation, but could not find anything. But it seems like something that should be available to implement.

Community
  • 1
  • 1
user2278764
  • 55
  • 1
  • 7
  • 1
    What do you want to *accomplish*? If one node goes down, the system is still available for writes (2/3 of the nodes are up and can elect a master), and majority then means 2 of the two available nodes, which is a reasonable way to replicate. Why would you change the write concern depending on the availability of nodes? – mnemosyn Mar 31 '15 at 13:55
  • 1
    I think the problem is that the OP is missing the proper meaning of `majority` (or most write concern setting, for that matter). @user2278764: the majority always is calculated on the nominal number of members, not the effective number. A replica set is fully aware of the fact that a member is down. – Markus W Mahlberg Mar 31 '15 at 16:06
  • Well, I realize how majority works. What I want to accomplish is this: I have three members in my replica set. Lets call them Optimus, Bumblebee and Ratchet. I want Optimus to be my primary to start off, whereas Bumblebee and Ratchet will be secondary. Now I want writes to be acknowledged by both Optimus and Bumblebee before getLastError is returned. I can do this by creating a getLastErrorMode for tags on Optimus and Bumblebee. However, in the event that Optimus goes down, I want to be able to continue writing to the new primary, which will not happen since Optimus is down. – user2278764 Mar 31 '15 at 20:48
  • I apologize for using the incorrect context the first time around when I asked the question. – user2278764 Mar 31 '15 at 20:54
  • I want to have this setup so that I can set the read preference to SecondaryPreferred (with tags for Bumblebee). So my application would not read stale data when reading from Bumblebee. – user2278764 Mar 31 '15 at 20:56

0 Answers0