I have a small doubt in this topic from the course topic. When the primary is stepped down as secondary, and don’t have a majority vote in the election to elect a primary node. In this case, we have no primary node in the cluster. Also, we cannot do any write operation without a primary.
In this situation what are the possibilities to regain full control over the replica-set?
I thought about adding one more node to the replica set. However we still need to use rs.add() which won’t work with Secondary. Is my understanding wrong?
Finally why is it a fail safe mechanism as instructor mentioned. I want someone to throw more light on this statement.
If you have a 3-member PSS(Primary, Secondary, Secondary), and if the current primary becomes unavailable or stepped down as secondary, an election determines the new primary. Refer Replica Set Elections for more details.
The election is first decided by priority. If both Nodes B & C have the same priority, then the one who is most up to date in respect to the failed primary (oplog) wins and becomes primary.
Correct , The replica set cannot process write operations until the election completes successfully. The replica set can continue to serve read queries if such queries are configured to run on secondaries.
If the primary node remains unavailable for longer than the configured timeout it triggers the automatic failover process. One of the remaining secondaries calls for an election to select a new primary and automatically resume normal operations, and we regain control over the replica set.
Correct To run the rs.add() method, you must connect to the primary of the replica set.