I have read in the MongoDB-replication-guide from the MongoDB website (http://docs.mongodb.org/master/MongoDB-replication-guide.pdf) the following statement on page 28, under section "2.3.1 Replica Set Elections":
"If a majority of the replica set is inaccessible or unavailable to the current primary, the primary will step down and become a secondary. The replica set cannot accept writes after this occurs, but remaining members can continue to serve read queries if such queries are configured to run on secondaries."
Is this statement true? Unless I misunderstand the above statement, this scenario seems very "BAD" to me. To me this statement is telling me that if I have a Replica set with three members that spans three data centers; i.e. data center 1 contains the primary member, data center 2 contains a secondary member, and data center 3 contains a secondary member; and if data centers 2 and 3 go down, then data center 1 will have the primary member revert to being a secondary member. This would be very bad for a production system running on data center 1. In this scenario, the primary member would become a secondary member and no more write operations would be allowed by the production system running on data center 1. Is this true? Why would anyone want this behavior? I can see a situation where one would want to take down data centers 2 and 3 for maintenance, or they might go down for some kind of failure, but that should not affect the production system running on data center 1. Can anyone please explain this statement in more detail to me?
This is to confirm that the statement you pointed out is absolutely true and we have recently faces it in our production system. Looking for a method where I can solve this happening from on my production system at least.
Any insights from the community is helpful.
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/d52cba00-903c-4e88-b61c-2c8e00a4c4ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
What do you think of using replicaset member priority to solve this?
For example. primary at DC1 has a priority of 5 and secondaries at DC2 & DC3 have a priority of 2.
So in the event of a network partition or DC2 / DC3 going down, primary at DC1 would continue to be primary.
Hi Darshan,
By ‘solving this’, I assumed that you are referring to the original question on this thread. Which is, if the majority of the replica set is inaccessible to the current primary, will the primary step down and become secondary ?
To clarify, the priority settings of replica set members is to affect the outcomes of elections for primary, and not to affect the fault-tolerance of the replica set. Using your example, if the two secondaries on DC2 and DC3 (majority) are not available to the primary on DC1, the primary will still step down to secondary regardless of priority values. See also Consider Fault Tolerance.
Setting the priority value is suitable if you prefer that the member(s) in one data center (i.e. DC1) be elected primary before the members in the other data centers. As you mentioned, in the event of the primary loss, one of the secondaries would step up temporarily until the member on DC1 is available again and caught up. See also member priority.
You may also be interested in:
Regards,
Wan.