This recipe teaches you how to configure replication using MongoDB replica sets.
When replication is performed using replica sets, one installation of MongoDB identifies as the primary server while others in the cluster are secondaries. The primary server accepts writes, which are replicated to the secondaries, while the secondaries service read requests. If the primary server goes down, the secondary servers automatically call a quorum and promote one of the secondaries to fill the primary's role. The old primary rejoins the cluster when it comes back on line. This configuration provides redundancy, distributed read/write access, and automatic failover for high-availability.