Black Friday: 40% off the first year. Until Sunday 29 November, code BLACKFRIDAY40.
ZeroBehind

Home / Guides

Switchover and failover for MariaDB, step by step

A replica you never switch to is a backup with extra steps. Two operations make it a standby: a planned switch of roles, and a takeover when the master is gone. They are different, and the difference is where data gets lost.

The planned switch

For maintenance, a move, or simply to prove that the standby works. Both servers are alive, so nothing has to be guessed.

On our own pair, under continuous writes, this took 3.5 seconds from start to finish. The application saw a pause of under half a second, and every acknowledged write was on both servers afterwards, checked row by row.

The takeover after a failure

The master is gone and cannot be asked for anything. Replication is asynchronous, so the last transactions may not have reached the replica. No tool can change that after the fact. What a tool can do is be honest about it.

When the old master comes back

This is the corner where replication setups break. A server that was replaced boots up and still believes it is the master.

Checked on every release

Eight role-switch scenarios and seven interruption scenarios run against real MariaDB servers under load before a version ships: an agent killed in the middle of a switch, a job that writes on the replica, a master that returns after it was replaced. When ZeroBehind cannot be sure, it stops and says why.

After a switch you can compare every table on the replica with the master, piece by piece, at the same point of the replication stream, while replication keeps running.

What it does not do

Want to see it on your servers?

Tell us what you run. We answer with what is covered and what is not.

Talk to us

Read next