Skip to content
BENIBIX Learn

Database Replication

Development🗃️ DatabasesScaling

Also known as Replication, Primary-Replica Replication

Live copies of a database kept on other servers. If one fails, the rest go on.

Think of it like

Think of it like a teacher writing on the board while kids copy it. If the board is wiped, the books still have it.

Example

Emma's shop runs one main server and two copies in other places. When the main disk dies, a copy takes over in under a minute.

Why it matters

One server is one point of failure. Replication keeps the data safe and the app running.

Definition

Database replication keeps copies of a database on more than one server. One server, the primary, takes the writes. It sends each change to the others, called replicas, which apply it too. If the primary fails, a replica can take over. Replicas can also share the work of reading, which spreads the load.

Common mistake

Treating copies as a backup. If someone deletes a table, the delete is copied to each one too.

Key takeaways

  1. 1
    One writes, many copy. The primary sends each change.
  2. 2
    Ready to take over. A replica can become primary.
  3. 3
    Not a backup. Mistakes are copied too.

Compare