If you're here, chances are that your database environment is no longer meeting your needs. Maybe you've been researching how to move your data and your functionality somewhere else. Perhaps you need more flexibility? Is the uptime not what it should be? The maintenance load getting to your team? Whatever the reason, you've concluded that you need a new managed database. Good, chances are we agree!
But slow down for a minute. Database migration is a complex process. Not only you need to ensure that the data is replicated correctly. You also need to minimize downtimes for your critical applications.
Five questions about moving to the cloud
It’s not possible to compare all the database migration tools in this blog. The 5 questions we're about to cover should help you in your research, and plan a migration that achieves your goals.
1. What's the source and what's the target?
Are you doing a homogeneous migration (same source and target database) or heterogeneous (different source and target databases) migration? This has implications for the amount of engineering and testing the process requires.
In a heterogenous migration, you may need to modify the SQL, migrate the code, convert schemas, and that's all in addition to the actual data migration.
2. Can you handle downtime?
You can't do migration with zero downtime. That's a given. But with planning and fine-tuned timing, you can cut down on the length and mitigate the effects.
If you can't afford major downtime, plan a blue-green strategy, where the old and the new databases instances run in parallel for a while. Do enough testing to convince you that the new database is working as expected. Then when everything is ready, close existing connections to the source databases and create new connections to the target databases. This switch is almost instantaneous.
The "almost" in the previous sentence means that some customers might experience issues. If this creeps you out, keep in mind the additional infrastructure costs of maintaining two databases. And of course the reasons you're switching in the first place!
If significant downtime is acceptable, you can make the switch without having two databases running at the same time. For example, you might not require data modification. There may be no need for schema changes. In this case, you can make the switch without any additional data infrastructure costs.
3. Are changes needed to the application code?
Consider if the state of the target database will be the same as the source database post migration. If not, it means spending more time and effort to make changes in application code.
Especially in heterogeneous database migrations, the schemas will be different the source and target databases. This will require changing your application queries. Be sure to budget time for this in advance.
4. What support is available for your migration toolkit?
There might be different database migration tool options available. What is the level of maturity and the amount of support provided for a given tool?
Remember, if things can go wrong (and they probably will), you'll need some help fighting the fire.
This help can take different forms. It may mean finding solid documentation for your migration toolkit. Or it may mean picking up the phone and troubleshooting your case with your managed service support.
Choose the tool (and associated support) that’s right for your level of database migration expertise.
5. Is your migration toolkit secure?
Consider how the preferred tool handles data security during the migration process. Is the data encrypted in motion?
And when everything's done, how do you safely destroy the data from the source database? Don't forget this important step.
Tip: an open source tool for moving PostgreSQL databases
Here at Aiven we've created an open-source tool to easily migrate PostgreSQL databases. It helps in moving to Aiven from other database service providers, like AWS RDS, or from on-premises data centers. Check it out at Aiven DB Migrate.
However, the tool is not limited to Aiven services - feel free to use it for all your PG database migration needs!
If you're ready to move to a different provider (hopefully Aiven :D), this article listed some factors to consider. We hope you have a secure and effective migration!
If you've already gone through the database migration process and would like to share some tips, please tweet to let us know!
Not using Aiven services yet? Sign up now for your free trial at https://console.aiven.io/signup!
And to get the latest news about Aiven and our services, plus a bit of extra around all things open source, subscribe to our monthly newsletter!