Databases & Data Storage
Replication
Definition
Database replication is the process of creating and maintaining multiple copies of a database. The copies, known as replicas, are kept in sync with the primary database to provide redundancy and improve data availability.
Why It Matters
Replication is essential for high availability and disaster recovery. If the primary database fails, the system can failover to a replica with minimal or no downtime. It can also improve read performance by distributing read queries across multiple replicas.
Contextual Example
A critical e-commerce database has a primary server in one data center and a read replica in another. All write operations go to the primary, which then replicates the changes to the replica. If the primary fails, the replica can be promoted to become the new primary.
Common Misunderstandings
- Replication can be synchronous (the primary waits for the replica to confirm the write) or asynchronous (the primary writes and then sends the change to the replica).
- Replication is not a backup. It protects against hardware failure, but not against accidental data deletion, which would be replicated to all copies.