MongoDB replica sets provide high availability through replication and automated failover. Here we have a cluster comprising three nodes: replicas “flip” and “flop”, plus an arbiter. Every 60 seconds, the PRIMARY will step down and the cluster will “failover” to the other node. This is a real, running replica set that you can connect to and experiment with. Have fun!
The purpose of flip-flop is not only to visually demonstrate the replica set election process, but it is also a means for you to become better at writing client driver connection code. Below is the connection URI for this replica set (note that this replica is running in authentication mode). Can your client/driver code survive failover without any manual intervention?
Here's a sample application for you to see how a properly configured Python application can gracefully recover from a replica set failover.