Replication is the process of creating and managing duplicate or redundant versions of a database. With Replication, one can create more than one copy of the same data. Replication provides redundancy, which in turn increases data availability. The more redundant or duplicate copies of the data we have, the higher will be the availability of data.
How does Replication work?
- Replication synchronizes a set of replicas so that the changes made in one replica set are reflected in all the others.
- In other words, the process of synchronizing the data among all the replica sets is called Replication, which results into all the replica sets having the same data sets.
- It enables multiple users to work on their own local copy of a database. When there is any change in the primary node, through synchronization it reflects in all the other nodes of the same replica set.
- With additional copies of data, each one can be dedicated to perform different tasks, such as disaster recovery, reporting, or backup.
- The primary database has multiple replica sets. A replica set, also known as Shard, further contains multiple replica set nodes.
Why do we Need Replication?
- Data Security – It keeps the data safe and secure, as there can be an additional replica set node for backing up data in the primary node.
- High Availability – With replication, data can be made accessible 24×7. If the primary node goes down, the data can still be accessed over secondary shards.
- Read Scaling – Replication provides with multiple extra copies of the data to read from.
- No Downtime for Maintenance (like backups, index rebuilds, compaction, etc.) -An alternative is always available, if the primary node data is under maintenance.
- Disaster Recovery – In case, the data in primary node gets corrupted or deleted, it can be recovered from the secondary node.
- Replica Set is Transparent to the Application – If there is any read or write operation, it will firstly hit the primary data and secondly the secondary data, which ensures data transparency among all the replica shards.
Got a question for us? Mention them in the comments section and we will get back to you.