Question

I have a two member replica set (within a sharded cluster), with no arbiter. I know that the recommended design is to have three servers (or an odd number) but right now I have to stick with this design.

The problem is that when the primary is down, the secondary doesn't get elected as a temporary master (since the priority for both servers is 1 and I have no arbiter).

Is there any way to get that automatic failover (slave becomes primary -> primary back online -> default primary gets its previous state)?

Thank you!

Was it helpful?

Solution

You MUST have at least 3 members in the replicaset, having 2 members is worse than having just a single node (NEVER EVER DO THIS!!). Your problem is worst than you think, the main problem is that if your secondary goes down, your primary will demote itself to a secondary and also effectively go down because you have no more primary. I don't know why you 'have to stick with this configuration, but it can not be a solution.

The solution to this is to create an arbiter, node, this is simply a lightweight member of the replicaset that has no actual data and is simply there to take part in the election for a new primary if one of the other members goes down.

OTHER TIPS

Unfortunatly to get an elected primary a majority of the set must be online.

There is a specifric word for the type of election process that is used but MongoDBs documentation, from what I can see, has been dumbbed down to remove this information which isn't helpful at all; infact I beleive it is http://en.wikipedia.org/wiki/Quorum

50% is not enough of the members.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top