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!
MongoDB supports replica sets, which can have up to 50 nodes.
MongoDB achieves replication by the use of replica set. A replica set is a group of mongod instances that host the same data set. In a replica, one node is primary node that receives all write operations. All other instances, such as secondaries, apply operations from the primary so that they have the same data set.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With