O'Reilly logo

MongoDB High Availability by Afshin Mehrabani

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Failover testing

In this section, we will deactivate the specific nodes to force the replica set to make an election and change the nodes' role.

First of all, we will deactivate one of the secondary nodes by stopping the mongod service on the secondary machine.

Right after stopping the service of mongod3.replicaset.com, the replica set will set this node as an unreachable secondary node, as shown in the following screenshot:

Failover testing

The status of the replica set shows that the third member has an issue, so this member becomes unavailable until the replica set gets a ping from it. After starting the service again, the members' status changes again as shown ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required