When most of the nodes are down and the number of remaining nodes that can be connected to each other does not exceed half, you can refer to the documentation to reconfigure the replica set:
- http://docs.mongodb.org/manual/tutorial/reconfigure-replica-set-with-unavailable-members/
Two methods are mentioned in the document:
One is to forcefully reconfigure this replica set, delete the down nodes from this replica set, and only the remaining running nodes form a new replica set, so that a new primary node (primary node) can be elected. ). If the MongoDB 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.
This depends on the total number of nodes in your replica set. When the number of nodes that can be contacted with each other in the replica set is greater than half of the total number of nodes, a new primary node can be selected. The replica set can work normally. If it can be contacted with each other If the nodes are less than or equal to half of the summary point, all nodes will become secondary nodes. At this time, the replica set will become read-only and all write operations will fail.
The reason for this phenomenon is that the mongodb replica set does not allow multiple primary nodes. When the number of nodes that can be contacted is less than or equal to half of the total number of nodes, if the primary can still be selected, multiple primary nodes may appear. This causes data chaos in the entire replica set and all nodes become secondary. The replica set can still run normally when the failed node is restored.
If you encounter a normal node that is not enough to select the primary, you can solve it in several ways.
When most of the nodes are down and the number of remaining nodes that can be connected to each other does not exceed half, you can refer to the documentation to reconfigure the replica set:
- http://docs.mongodb.org/manual/tutorial/reconfigure-replica-set-with-unavailable-members/
Two methods are mentioned in the document:
This depends on the total number of nodes in your replica set. When the number of nodes that can be contacted with each other in the replica set is greater than half of the total number of nodes, a new primary node can be selected. The replica set can work normally. If it can be contacted with each other If the nodes are less than or equal to half of the summary point, all nodes will become secondary nodes. At this time, the replica set will become read-only and all write operations will fail.
The reason for this phenomenon is that the mongodb replica set does not allow multiple primary nodes. When the number of nodes that can be contacted is less than or equal to half of the total number of nodes, if the primary can still be selected, multiple primary nodes may appear. This causes data chaos in the entire replica set and all nodes become secondary. The replica set can still run normally when the failed node is restored.
If you encounter a normal node that is not enough to select the primary, you can solve it in several ways.