From another Databasezy instance
Tested with: zb migrate 0.1
An instance-to-instance migration copies one Databasezy instance into another in the same organization. It is the path for major version upgrades, moving regions and moving a database onto secure hosting.
| Status | Coming soon · phase 2 |
|---|---|
| Target engines | PostgreSQL , MySQL , MariaDB , Valkey , Redis (compat) , libSQL / SQLite , DuckDB , MongoDB (Percona Server) , FerretDB (MongoDB-compatible) , ClickHouse , InfluxDB 3 , QuestDB , Meilisearch , Qdrant , Weaviate , CouchDB , TypeDB , TimescaleDB |
| How we read it | Instance to instance |
| Continuous sync | Yes, for PostgreSQL and MySQL |
| Provider preset | None yet (generic) |
Before you start
Section titled “Before you start”- Both instances in the same organization, and permission to read the source and write the target.
- A target instance of the same engine family, created with the version, region, size or placement you want.
Find the connection string
Section titled “Find the connection string”There is no connection string: pass the source instance’s name or id. No egress allow-listing is needed.
Another Databasezy instance notes
Section titled “Another Databasezy instance notes”- Used for engine version upgrades, region moves and moving a database onto secure hosting.
- Major version upgrades: create the target on the new version and copy with sync. See engine version upgrades.
- Region moves: create the target in the new region. Data copied across regions counts as egress.
- Secure hosting: create the target with
--placement secure(needs a signed BAA). To move an existing instance instead and keep its host name, change its placement in the portal or withPATCH /v1/orgs/{org}/instances/{id}and{"placement": "secure"}. See Secure hosting and the BAA.
Migrate
Section titled “Migrate”- Open the target PostgreSQL instance (create one first if you need to) and choose the Migrate in tab.
- Under Source, pick Another Databasezy instance and choose the source instance from your organization.
- Choose Copy and sync to keep the target current until cutover, or Copy for a one-off copy.
- Run Preflight and work through the checklist. Blocking items must be fixed before the copy starts.
- Start the copy and follow Copy and Verify. Mismatches are listed per table or collection.
- When the sync lag is low, stop writes and choose Cut over. The Report step keeps the timings and verification results.
# New target: a newer major in the same region (or another region, or --placement secure)zb instances create --engine postgres --engine-version 17 --size m2 --region us-east --name pg-prod-17 --wait
zb migrate --from pg-prod --to pg-prod-17 --mode copy_and_sync --dry-runzb migrate --from pg-prod --to pg-prod-17 --mode copy_and_synczb migrate status mig_123zb migrate cutover mig_123curl -sS https://api.databasezy.com/v1/orgs/$ZB_ORG/instances/inst_abc/migrations \ -H "Authorization: Bearer $ZB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "source": { "kind": "zerobase", "instance_id": "pg-prod" }, "mode": "copy_and_sync"}'
# Follow progress, preflight report and verificationcurl -sS https://api.databasezy.com/v1/orgs/$ZB_ORG/instances/inst_abc/migrations/mig_123 -H "Authorization: Bearer $ZB_API_KEY"
# Cut over once the status is ready_for_cutovercurl -sS -X POST https://api.databasezy.com/v1/orgs/$ZB_ORG/instances/inst_abc/migrations/mig_123/actions/cutover -H "Authorization: Bearer $ZB_API_KEY"Verify
Section titled “Verify”Verification compares what the engine exposes: row counts per table for SQL engines, document counts per collection
for document engines, key counts for key-value engines. Mismatches are listed in zb migrate status <mig_id> and
the Verify step. Run your application’s tests against the new instance before you switch traffic.
Continuous sync and cutover
Section titled “Continuous sync and cutover”With copy and sync, the target keeps receiving changes after the copy. When zb migrate status reports
ready_for_cutover (two lag samples in a row under 5 seconds):
- Stop writes to the source: maintenance mode, scale writers to zero, or revoke the application user.
- Run
zb migrate cutover <mig_id>(or Cut over in the portal). The agent drains the last changes, copies sequence values (PostgreSQL), verifies again and stops replication. If the target cannot catch up in time, the cutover is abandoned and sync keeps running; nothing changes on either side. - Point the application at the Databasezy connection string and resume writes.
zb migrate statusshows the measured downtime.
Schema changes are not replicated, so freeze migrations between the copy and cutover. Details: what happens at cutover.
Sync applies to PostgreSQL and MySQL targets only; other engines from this source are copy only.
Roll back
Section titled “Roll back”A migration never deletes anything on the source. Until you decommission it, rolling back means pointing the application back at the source.
- Before cutover: cancel with
zb migrate cancel <mig_id>. The publication, replication slot or replication channel the migration created is removed. - After cutover: writes made on Databasezy are not on the source. For PostgreSQL, start the migration with
--reverse-syncso the old database keeps receiving them after cutover and stays a valid fallback. Without it, copy the new data back with a migration in the other direction before you switch.
Troubleshooting
Section titled “Troubleshooting”The target refuses the copy
Section titled “The target refuses the copy”The engines are not compatible. Instance-to-instance copies stay within an engine family; see engine conversions for the supported pairs.
The restore stops on an extension
Section titled “The restore stops on an extension”The source uses an extension Databasezy does not ship. Drop it on the source if it is unused, or exclude the objects that depend on it with --exclude.
Sync is blocked with pg.wal_level or pg.replica_identity
Section titled “Sync is blocked with pg.wal_level or pg.replica_identity”Logical replication needs wal_level=logical on the source and a primary key (or REPLICA IDENTITY FULL) on every published table. Preflight lists the tables.
Sync is blocked on binlog or GTID settings
Section titled “Sync is blocked on binlog or GTID settings”Continuous sync needs binlog_format=ROW, gtid_mode=ON, enforce_gtid_consistency=ON and a user with REPLICATION SLAVE and REPLICATION CLIENT. Preflight names whichever is missing.
For anything else, zb migrate status <mig_id> shows the failing step and its message. How migrations work describes every step.