Overview
Database migrations are a critical part of maintaining and upgrading your database infrastructure. This guide explains how to safely perform database migrations while ensuring your data replication continues to work correctly with Artie.Blue/green source database migration
An AWS blue/green deployment copies your database to a new green environment and then switches your application to it.Amazon RDS and Aurora PostgreSQL
Use these steps when you upgrade an Amazon RDS or Aurora PostgreSQL database with an AWS blue/green deployment. The steps follow the limits that AWS documents:- AWS does not create a blue/green deployment when non-physical replication slots exist. Creation fails with the error
Replica creation is canceled due to external replication. See the AWS troubleshooting article. - The blue database cannot be a logical replication publisher. See the AWS blue/green deployment considerations.
- Stop application writes.
- Let Artie read all changes.
- Pause the pipeline.
- Drop the Artie replication slot.
- Create the blue/green deployment.
- Switch over to green.
- Point the network path to the green writer.
- Resume the pipeline.
- Make sure that a test row gets to the destination.
- Start application writes again.
Stop application writes
Let Artie read all changes
Pause the pipeline
active as false.Drop the Artie replication slot
Create the blue/green deployment
rds.logical_replication is 1 in the green parameter group.Do not run DDL, GRANT or REVOKE on blue during the deployment. AWS blocks the switchover after these changes.Switch over to green
Point the network path to the green writer
healthy.Resume the pipeline
Make sure that a test row gets to the destination
Start application writes again
In-place major version upgrade
PostgreSQL in-place upgrade
To upgrade with an AWS blue/green deployment, use the Amazon RDS and Aurora PostgreSQL steps. Do these steps in this order:- Stop application writes.
- Let Artie read all changes.
- Pause the pipeline.
- Drop the Artie replication slot.
- Upgrade the database.
- Resume the pipeline.
- Make sure that a test row gets to the destination.
- Start application writes again.
Stop application writes
Let Artie read all changes
behind_bytes must be small, and it must not increase.Pause the pipeline
active as false.Drop the Artie replication slot
artie. If you set an override, use that name.Upgrade the database
Resume the pipeline
postgres_version must show the new version. active must be true. behind_bytes must be zero or more. A negative value means that Artie uses an old position. If you see a negative value, keep writes stopped and contact Artie.Make sure that a test row gets to the destination
Start application writes again
Other databases
- Schedule an application downtime and pause your application.
- In the analytics portal, check that Artie has caught up. Then click Pause pipeline and choose the Pause pipeline option, which also stops Artie from reading the source.
- Perform the database upgrade and restart your database server.
- Resume your Artie pipeline.
- Resume your application.
Database-specific considerations
PostgreSQL
PostgreSQL
- Ensure
wal_levelis set tologicalin your new version - Verify that all required extensions are available in the new version
- Check that your replication slots are properly configured
MySQL
MySQL
- Verify
binlog_formatis set toROW - Ensure
binlog_retention_hoursis set appropriately (recommended 24+ hours) - Check that GTID is enabled if you’re using it
MongoDB
MongoDB
- Ensure your replica set is properly configured in the new version
- Verify that change streams are enabled
- Check that your service account has the correct permissions
Minor version upgrade
Minor version upgrades (e.g., PostgreSQL 14.1 to 14.2) do not require stopping database replication. These upgrades are typically handled automatically by your database provider and applied during your maintenance window.- Monitor your replication lag during the upgrade
- Have a rollback plan ready
- Test the upgrade in a staging environment first
Best practices
- Always test migrations in a staging environment first
- Back up your data before any major version upgrade
- Monitor replication lag during and after the upgrade
- Keep your Artie pipeline paused until the upgrade is complete
- Verify data consistency after the upgrade
Troubleshooting
What happens when Artie is resumed?
What happens when Artie is resumed?
artie, unless you set an override. If the slot is missing or the Postgres major version changed, Artie resets its saved position. Artie then starts on the new slot and captures changes from that point.For other sources, Artie resumes from the last position it saved. If the database no longer has that position, contact us so we can backfill.What should I do if there is data loss?
What should I do if there is data loss?
- Document the extent of data loss
- Note the approximate time window affected
- Contact our support team immediately
- Keep your pipeline paused until we can assist
Postgres tips
Postgres tips
active is false. Then drop the replication slot.Common issues
Common issues
- Replication slot overflow: If you see this error, you may need to increase your WAL retention period
- Connection issues: Verify your database credentials and network connectivity
- Permission errors: Ensure your service account has the correct permissions after the upgrade
- Schema changes: Check if any schema changes were made during the upgrade that might affect replication

