Migrating multi-gigabyte production databases between servers or database engines (e.g. MySQL to PostgreSQL, or SQLite to cloud databases) traditionally required taking applications offline for hours.
zero-downtime-db-sync is an open-source CLI utility designed to perform live, streaming schema and data migrations with continuous replication and zero application downtime.
seotarek
/
zero-downtime-db-sync
A resilient, zero-downtime streaming database migration and replication CLI tool for MySQL, PostgreSQL, and SQLite.
Zero-Downtime DB Sync ⚡
A resilient, chunk-based streaming database migration and live data replication CLI tool. Safely migrate gigabyte-scale databases across servers with automatic network checkpointing, zero RAM bloat, and minimal table lock time.
💥 The Problem It Solves
-
Dump & Restore Fails on Large Tables: Traditional
mysqldumporpg_dumpcreates massive files that lock read/write traffic and timeout on unstable networks. - Network Dropouts Waste Hours: If an SCP transfer drops at 99%, you typically have to restart from scratch.
- RAM Spikes Crash Instances: Reading whole tables into memory crashes low-spec VPS or containers.
Zero-Downtime DB Sync streams rows in configurable primary-key batches, tracks the last committed ID in a persistent checkpoint file, and resumes seamlessly if interrupted.
🚀 Key Features
- Chunked Streaming: Consumes memory in predictable O(chunk_size) bounds using server-side cursors.
- Fault-Tolerant Checkpointing: Tracks migration progress down to the exact row ID; automatically resumes after network disconnects.
- Cross-Engine…
⚙️ How It Works
- Initial Parallel Snapshot: Streams existing table rows in concurrent batches using cursor-based pagination.
- Change Data Capture (CDC): Listens to WAL / binlog change events to capture real-time writes occurring during the migration.
- Atomic Verification: Performs row count and checksum audits across source and destination tables before initiating switchover.
Install and run via CLI:
db-sync migrate --source "mysql://user:pass@host/db" --target "postgres://user:pass@host/db" --live
Contribute and view documentation on GitHub:
👉 https://github.com/seotarek/zero-downtime-db-sync
Top comments (0)