DevOps · Oct 2026 · 6 min read · 04/05
Near-zero downtime migration of a 40GB production database
Moving a live 40GB+ government database to a new server with mydumper, replication and a short write freeze instead of a full outage.

A few weeks ago I had to migrate a 40GB+ production database for a government authority, from an on-site server to a more scalable, robust database server, with one constraint: it was a live system. No acceptable full outage window.
Here's the approach I took, as a near-zero downtime migration.
1. Build the green environment
Set up the new server (green) with read replicas, direct connections, and monitoring in place before touching production data.
2. Take a consistent backup of blue
Blue is the current production environment. I used mydumper to dump the database to a RAID 5 configured disk.
Worth being precise about how this works: mydumper takes a brief global read lock (FLUSH TABLES WITH READ LOCK) just long enough for every dump thread to start a consistent InnoDB snapshot. Once all threads have their snapshot, the lock is released. The bulk of the 40GB dump runs against that snapshot without blocking writes on blue. (MyISAM tables are the exception. Those get locked for the duration of their own dump, since they don't support consistent snapshots.)
3. Restore to green and establish replication
I used myloader to restore the dump into green, then set up replication from blue to green using the binlog position captured at snapshot time. From this point, blue kept serving all reads and writes in production, while streaming changes to green in near real time.
4. Continuous validation
I ran data validation checks every 30 minutes to confirm blue and green stayed in sync as replication caught up.
5. Brief write freeze for final cutover
I enabled maintenance mode, making blue read-only. This is the one deliberate downtime window in the whole process: a short write freeze, not a full outage, giving replication time to fully catch up. I verified consistency by checking that replication lag hit zero (via GTID position / Seconds_Behind_Master) before proceeding.
6. Cut over via DNS
Once consistency was confirmed, I switched the database endpoint via DNS to point at green.
7. Rollback plan
I kept a plan ready to switch back to blue via DNS if anything surfaced after cutover. The whole point of the read-only freeze was making that reversible until the last possible moment.
We rehearsed this entire sequence multiple times in staging before touching production.
I'd call this "near-zero downtime", not zero downtime. Writes were briefly frozen during the final sync, reads never stopped.
That distinction matters when you're describing this to other engineers.
Curious what others use for the backup step at this scale. mydumper/myloader worked well here, but I know XtraBackup (physical backup) is often preferred for very large datasets, since it's faster and puts less load on the live server during the dump. Would love to hear what's worked for others doing live migrations at scale.