Home›Learn›Many servers 1: keep a copy running
Many servers · Chapter 1

Keep a copy running

One server is one disk, one power supply and one kernel. When any of them dies, your app stops taking orders. Every engine fixes this the same way: keep a second copy up to date, and have a way to decide which copy takes the writes. This page is the map. Each engine's own chapter has the details and the commands.

Six engines, one idea

Pick your engine

PostgreSQLReplicas replay the primary's log. Patroni keeps the leader key in etcd and promotes a replica when the leader stops renewing it.Read the chapter
Patroni · CloudNativePG on Kubernetes
MySQLGroup Replication votes on every commit inside InnoDB Cluster. With plain async replication, Orchestrator watches from outside and promotes a replica.Read the chapter
InnoDB Cluster · Orchestrator · Percona operators
MongoDBA replica set holds an election. The member with the newest data and a majority of votes becomes primary.Read the chapter
Replica sets · Percona operator
RedisSentinel watches a primary and its replicas and promotes one. Redis Cluster splits keys across primaries, each with its own replicas.Read the chapter
Redis high availability
CassandraThere is no primary. Every replica takes writes, and the consistency level decides how many must answer.Read the chapter
Cassandra high availability
Vector databasesThe index is data too. It has to be copied or rebuilt on the new node before search answers the same way.Read the chapter
Vector database high availability
The three questions

Every setup answers the same three questions

How does the copy get the changes?

The primary already writes every change to a log before it touches the data files. The copy reads that log and replays it. The only question is how far behind it is.

Who decides the primary is dead?

Not the primary itself, and not one replica on its own. Something that can count votes: etcd for Patroni, the group in InnoDB Cluster, the replica set election, or Orchestrator watching from outside.

What can you lose on failover?

Anything the primary said yes to that the copy had not received yet. Unless the commit waited for the copy. That wait is the price, and what a commit waits for shows it engine by engine.

When it goes wrong

Failover in production

The symptoms playbooks cover replica lag and a failover that did not happen. The hands-on labs break a real Patroni cluster for you to fix. The DBA agent can run a planned switchover, and asks before each change.

Next · chapter 2Who is the leaderConsensus, votes and split brain
Part 1 of 4 · Learn · 56 pagesAll pages

How do databases actually work? From one row on disk to transactions: the words you need, PostgreSQL, MySQL and MongoDB from the files up, then Redis, Cassandra and vector search, side by side, and the query and concurrency traps.

Start 1: the basicsStart 2: ten conceptsStart 3: how a query travelsStart 4: napkin mathThe courseShort videosPostgreSQL 1: why PostgreSQLPostgreSQL 2: how it stores your dataPostgreSQL 3: what happens on every writePostgreSQL 4: high availability with PatroniPostgreSQL 5: running it as a DBREPostgreSQL 6: when it breaksPostgreSQL on Kubernetes: CloudNativePGMySQL 1: why MySQLMySQL 2: how it stores your dataMySQL 3: what happens on every writeMySQL 4: high availability with InnoDB ClusterMySQL 5: running it as a DBREMySQL 6: when it breaksMySQL failover with OrchestratorMySQL on Kubernetes: the Percona operatorsMongoDB 1: why MongoDBMongoDB 2: how it stores your dataMongoDB 3: what happens on every writeMongoDB 4: high availability with replica setsMongoDB 5: running it as a DBREMongoDB 6: when it breaksMongoDB on Kubernetes: the Percona operatorB-tree and LSM treeRedis 1: why RedisRedis 2: how it stores your dataRedis 3: high availabilityRedis 4: running it as a DBRERedis 5: when it breaksCassandra 1: why CassandraCassandra 2: how it stores your dataCassandra 3: high availabilityCassandra 4: running it as a DBRECassandra 5: when it breaksVector databases 1: why vector searchVector databases 2: how it stores your dataVector databases 3: high availabilityVector databases 4: running it as a DBREVector databases 5: when it breaksDatabase familiesEngines side by sideQueries that look fine and are notLost updates and write skewMany servers 1: keep a copy runningMany servers 2: who is the leaderMany servers 3: CAP as settingsMany servers 4: unique IDsMany servers 5: split the dataMany servers 6: across servicesMany servers 7: a thousand databasesStaff path, zero to architect