Understanding replication
Replication is the process of synchronizing data across multiple servers. (http://docs.mongodb.org/manual/core/replication-introduction/).
In a replica set, each node can be hosted in different servers. Hence, you need to synchronize data between all nodes. MongoDB named this procedure replication. The following diagram shows you the process of replication:
You can see the replication procedure in the preceding diagram that is used to synchronize data between the primary
node, which accepts all read/write operations, and secondary
nodes. Thus, all secondary
nodes and primary
nodes will have the same dataset after completing the synchronization process.
With the replication procedure, you will have redundancy in your database, but this redundancy brings data availability. Furthermore, multiple copies of a single database protect the database from failure, data loss, or hardware crashes. On the other hand, you can simply assign a dedicated server for backup or failure...