Case fileData Engineering
5 TB Zero-Downtime MySQL Migration
A 24/7 production system on legacy MySQL 5.7 with roughly 5 TB of data, moved to a modern MySQL environment by replication with no service interruption at cutover.
5 TBof production data moved with zero service interruption
- Enters through
- 02Data Engineering
- System type
- Production database migration
- Also demonstrates
- infrastructure · replication · SQL optimization · production risk management
- 1Compatibility auditon the source
- 2Variable remediationon the source
- 3Replica buildsource serving · replica building
- 4Synchronizationsource serving · replica building
- 5Promotioncutoveron the replica
- 6Query modernizationon the replica
01 Context
The challenge
A production database of approximately 5 TB was running on legacy MySQL 5.7 under a 24/7 workload. It had to move to a modern MySQL environment, and there was no maintenance window in which the system could stop.
A migration of that size cannot be a dump and restore. Data keeps changing during the copy, the newer MySQL version rejects configuration the old one accepted, and the moment of cutover is the moment the business is exposed.
What made it non-trivial
- Approximately 5 TB of data that kept changing under a 24/7 workload
- No maintenance window: zero service interruption was the requirement
- Deprecated variables and compatibility differences between MySQL 5.7 and the target
- A single cutover moment with the whole system depending on it
02 The system
What Qzentra engineered
Qzentra planned and ran a replication-based migration. The MySQL 5.7 workload was audited for compatibility with the target environment, and deprecated variables were remediated before any data moved.
A replica was built on the modern environment and synchronized with the live source while it continued to serve traffic. At cutover the replica was promoted, with no service interruption. Afterwards, queries were modernized using common table expressions.
What Qzentra was responsible for
- Migration planning and production risk management
- Compatibility audit and deprecated-variable remediation
- Replica build and synchronization
- Promotion at cutover
- Post-migration query modernization with CTEs
03 The route
How the system works
Five steps, all in the two foundation layers. Nothing above Infrastructure was touched, and nothing needed to be.
- 1Compatibility audit of MySQL 5.7 workloadData
- 2Deprecated variable remediationInfrastructure
- 3Replica build and synchronizationInfrastructure
- 4Replica promotion at cutoverInfrastructure
- 5Query modernization with CTEsData
Compatibility audit of MySQL 5.7 workload
DataThe existing workload was audited against the target MySQL environment before anything moved, to find what would break.
Deprecated variable remediation
InfrastructureConfiguration variables deprecated in the target version were remediated on the source side, so the target would accept the workload.
Replica build and synchronization
InfrastructureA replica was built on the modern environment and kept synchronized with the live source, which continued to serve traffic.
Replica promotion at cutover
InfrastructureCutover was the promotion of the synchronized replica to primary. There was no service interruption.
Query modernization with CTEs
DataAfter the migration, queries were modernized using common table expressions, as a separate step from the cutover.
04 Decisions
Engineering decisions
Replication, not dump and restore
With roughly 5 TB changing under a 24/7 workload, the way to move without stopping is to build a replica and keep it synchronized until the switch.
Compatibility first
The 5.7 workload was audited against the target before migration and deprecated variables were remediated, so incompatibilities were found in the audit rather than at cutover.
Cutover as promotion
Cutover was the promotion of an already synchronized replica. That reduces the switch to a controlled step rather than a data move.
Modernize after, as a separate step
Query modernization with CTEs was done after the migration, not folded into the cutover.
05 Verified outcomes
What was achieved
- Zero service interruption at cutover
- Approximately 5 TB of production data migrated from MySQL 5.7 to a modern MySQL environment
- Compatibility issues and deprecated variables remediated before cutover
- Queries modernized with CTEs after migration
06 Technology and capabilities
Technology, after the architecture
Named last, with the role each played. The capabilities are what the project demonstrates beyond its primary service.
- MySQL 5.7Source environment, 24/7 production
- MySQL, modern environmentTarget environment
- MySQL replicationReplica build, synchronization, and promotion
- SQL and CTEsPost-migration query modernization
Capabilities demonstrated
08 Discuss a project
Running a production database you cannot afford to stop?
Tell us the version, the size, the workload, and what it has to move to. Migrations are planned from the risk backwards.