This post has been republished via RSS; it originally appeared at: Microsoft Data Migration Blog articles.
Overview:
Azure Database for PostgreSQL recently announced Flexible Server, Flexible Server is a new deployment option for Azure Database for PostgreSQL that gives you the control you need with multiple configuration parameters for fine-grained database tuning along with a simpler developer experience to accelerate end-to-end deployment. With Flexible Server, you will also have a new way to optimize cost with stop/start capabilities.
In this article, we will provide a guideline on how to leverage Azure DMS for seamless and simplified migrations of your database from Azure PostgreSQL Single Server to Azure PostgreSQL Flexible Server with minimal downtime.
Important - Azure Database for PostgreSQL - Flexible Server is still in preview as of Jan 2021.
1 – Prepare the Source – Azure PostgreSQL - Single Server
You will need to set some Postgresql Parameters on the source as follows:
-- parameter wal_level should be logical, on Azure PgSQL this can be done from Azure Portal as shown blow:
-- max_replication_slots = [number of slots], recommend setting to 5 slots
-- max_wal_senders =[number of concurrent tasks] - The max_wal_senders parameter sets the number of concurrent tasks that can run, recommend setting to 10 tasks
-- the user must have 'userepl' privilege, if replication not granted, you can grant it as follows:
select * from pg_roles;
ALTER USER <user-name> WITH REPLICATION;
2- Prepare the target for the migration - Flexible Server
You will need to migrate database schema from source to target using commands:
-- on the source, create a schema dump file for a database
-- Import the schema into the target database
-- Remove foreign keys in schema at target Azure Database for PostgreSQL
-- Disable triggers at target Azure Database for PostgreSQL
The migration service internally handles the enable/disable of foreign keys and triggers to ensure a reliable and robust data migration. As a result, you do not have to worry about making any modifications to the target database schema.
So you don't need to manually disable it.
-- Provision Database Migration Service and create a migration task
More details in Tutorial: Migrate PostgreSQL to Azure Database for PostgreSQL online via the Azure CLI - Azure Database Migration Service | Microsoft Docs
3 – Create Migration Project
You will need to use PostgreSQL as source server type and provide the single server endpoint and credentials.
Note:- You will need to make sure the connectivity between the source single server and DMS service on one side and the DMS service and the target flexible server on the other side.
Details steps: Tutorial: Migrate PostgreSQL to Azure DB for PostgreSQL online via the Azure portal - Azure Database Migration Service | Microsoft Docs
4- Monitoring the migration project progress and you can perform the migration once it’s ready for cutover
Note:- After migration is complete, you might need to re-enable the triggers and create foreign keys.
I hope you find this article helpful. If you have any feedback please do not hesitate to provide it in the comment section below.
Ahmed S. Mazrouh