What Is Database Replication?

Replication continuously copies data from one database (the primary) to one or more other databases (replicas), keeping them synchronized.

Published November 20, 2026

Database replication keeps copies of the same data on multiple servers: a primary accepts writes and replicas receive them, improving read capacity, availability and backups.

The concept

Changes are shipped as a binary log or WAL stream. Asynchronous replication is fast but replicas can lag; synchronous replication waits for replicas, trading latency for safety.

Read-heavy apps send reads to replicas and writes to the primary. If the primary fails, a replica can be promoted (failover).

Primary and replicas

binlogbinlogPrimarywritesReplica 1readsReplica 2reads
Writes go to the primary; reads can use replicas.

Practical examples

Laravel read/write split

'mysql' => [
  'read'  => ['host' => ['10.0.0.2', '10.0.0.3']],
  'write' => ['host' => ['10.0.0.1']],
]

Check lag (MySQL)

SHOW REPLICA STATUS\G   -- Seconds_Behind_Source

Read-your-writes

After a write, read from the primary briefly to avoid stale replica data

Common mistakes

  • Reading just-written data from a lagging replica.
  • Treating replicas as backups (they replicate deletes too).
  • No failover plan.

Key takeaways

  • Copies of data across servers.
  • Scale reads and add availability.
  • Watch replication lag.

FAQ

Replication vs backup?

Replication copies changes live, including mistakes; backups are point-in-time.

Multi-primary?

Possible but needs conflict handling.

More SQL articles