Suppose there is a scenario in which there is a replica set of MongoDB. Due to the failure, only two nodes are available, and both nodes are currently available.
slaveNode. Other failed nodes cannot be restarted, that is, they cannot be re-added to the replica set.
Q: Is this replica set unusable in this case?
When most nodes are down and the remaining number of nodes that can be connected to each other is less than half, you can refer to the documentation to reconfigure this replica set:
There are two methods mentioned in the document:
- One is to forcibly reconfigure the replica set, delete the down nodes from the replica set, and only form a new replica set from the remaining running nodes, so that a new primary can be elected. If MongoDB’s version is 2.0 or above, you can use this method.
- Another way is to replace this replica set. If your MongoDB version is below 2.0, you can use this method.