Migrating from Amazon RDS for MySQL to Azure Database for MySQL online using Azure DMS
Published Dec 04 2023 11:42 AM 2,804 Views
Microsoft

While the idea of using an online migration might sound appealing, it’s important to remember the complexity of the process, which depends on a variety of key factors. Successfully completing an online migration requires that you follow a well-structured migration strategy and that you implement it flawlessly.

 

In a previous blog post, we explored a range of strategies for migrating from AWS RDS for MySQL to Azure Database for MySQL, which:

  • Discussed how to leverage these strategies to enhance efficiency and reduce costs.
  • Delved into important migration considerations.
  • Highlighted the significance of meticulous planning and preparation.
  • Cast light on potential challenges that may surface during the process.

In this blog post, I’ll guide you through the detailed steps involved in performing an online migration from Amazon RDS for MySQL to Azure Database for MySQL using Microsoft Azure Database Migration Service (DMS).

 

For reference, a sample AWS to Azure connectivity diagram with a detailed network architecture is shown in the following graphic.

1-cropped.png

 

Prerequisites

Before you begin this migration procedure, be sure that the following prerequisites are in place.

  • Establish a connection between Azure and AWS by connecting AWS Virtual Private Gateway with the Azure VPN Gateway. For more information about creating this VPN, see the article How to create a VPN between Azure and AWS using only managed solutions.
  • Because Azure Database for MySQL only supports the InnoDB Storage engine, convert ISAM tables to InnoDB. For more information, see Converting Tables from MyISAM to InnoDB.
  • Create a target Azure Database for MySQL flexible server. Be sure to select the appropriate Flexible Server service tier based on your understanding and assessment of source databases.
  • Ensure that the sql_mode parameter on the source and target servers is set to the same value.
  • Ensure that the binlog_format on the source server is not mixed.

Performing the migration

When using Azure DMS to migrate Amazon RDS for MySQL to Azure Database for MySQL, there are several key phases:

  • Creating an Azure DMS instance.
  • Creating a migration project.
  • Configuring the migration project.
  • Monitoring the migration.
  • Completing post-migration activities.

The following sections cover each phase in more detail.

 

Create an Azure DMS instance

To create an instance of Azure DMS, perform the following steps.

  1. In the Azure portal, select + Create a resource.
  2. On the Create a resource page, search for Azure Database Migration Service, and then select Azure Database Migration Service from the drop-down list.rkblog_diag1.png
  3. On the Marketplace page, in the Azure Database Migration Service card, select Create, and then select Azure Database Migration Service. rkblog_create.png
  4. On the Select migration scenario and Database Migration Service page, specify the following details:
    • Source server type: MySQL
    • Target server type: Azure Database for MySQL
    • Database Migration Service: Database Migration Service (classic)rkblog_diag2.png
  5. Select Select, and then, on the Create Migration Service page screen, on the Basics tab, specify the subscription, a new or existing resource group, a name for the service, and the location, and ensure that the service mode is set to Azure.rkblog_diag10.png
  6. To the right of Pricing tier, select Configure tier, and then select Premium (Standard only supports offline migration). Note: You can increase the vCores to 8 from the backend by raising a support ticket. 
    Configure-cropped.png
  7. Select Apply, and then, on the Networking tab, select an existing virtual network or create a new one.
    networking tab-cropped.png
  8. Select Review + create.

    Note: You can also choose to add tags to the service instance on the Tags screen.

  9. Review the configurations to ensure their accuracy, and then select Create to create the instance of the service.

 

Create a migration project

To create a migration project, perform the following steps.

  1. In the Azure portal, search for Azure Database Migration Service, and then select Azure Database Migration Services.
  2. Select your Azure DMS instance from the search results, and then select + New Migration Project
    dmsht-cropped.png
  3. On the New migration project page, specify a name for the project, and then specify the following details:
    • Source server type: MySQL
    • Target server type: Azure Database for MySQL (Single or Flexible)
    • Migration activity type: Online Data migration

      new migration-cropped.png
  4. Select Create and run activity.

 

Configure the migration project

To configure the migration project, perform the following steps.

5. On the Select source screen, specify the connection details for the source MySQL instance.
select source.png

6. Select Next: Select target>>, and then, on the Select target page, specify the connection details for the target Azure Database for MySQL instance.
select target-cropped.png

 

 

7. Select Next: Select databases, On the Select databases page, map the source and the  target database for migration.

Note: If the target database contains the same database name as the source database, Azure DMS selects the target database by default.

rkblog_diag11.png

 8. On the Select tables page, select the tables to include in the migration.

rkblog_diag12.png

9. Click Review and start migration.

10. On the Summary page, in the Activity name text box, specify a name for the migration activity and review the summary to ensure that the source and target details match what you previously specified.

rkblog_diag13.png

11. Select Start migration. The migration activity window appears, and the Status of the activity is Initializing. The Status changes to Running when the table migrations start.

rkblog_diag15.png

 

Monitor the migration

  • On the migration activity screen, select Refresh to update the display and see progress in terms of the number of tables completed.

Complete post-migration activities

To complete post-migration activities, perform the following step.

  1. On the migration project page, select Start Cutover to initiate the cutover between the source server and the target server. rkblog_diag16.png

  2. Create logins, roles, and permissions as per the application requirements.
  3. Re-direct the application to newly migrated target.
  4. Perform sanity testing of the application against the target database to certify the migration.
  5. Post successful validation, return the server configurations to their previous values if you had scaled them up to get better performance during migration.
  6. Take the AWS RDS MySQL source database offline after the migration is successfully completed and validated.
  7. Revert the server parameters and configuration to values required by your workload.
  8. Read replicas are not migrated by DMS so read replicas need to be created post migration.

Best practices

A collection of best practices to consider appears in the following list.

  • Even after careful planning and selecting the appropriate data transfer methods, there is always the chance of potential for unexpected problems, so it is important to plan for contingencies, such as creating a rollback plan. Some companies also maintain backward compatibility for a week/fortnight to ensure shifting back is smooth in case of any major migration issue.
  • It is recommended to do a dry run at least 2 times in a lower environment to estimate the migration time along with potential issues. Please ensure that the lower environment has similar data size and schema structure same as production environment.
  • It is recommended to disable/remove the trigger from source before migration and create it after migration.
  • For faster data loads using the Azure Database Migration Service, the following server parameters and configuration changes are recommended.
    • max_allowed_packet – set to 1073741824 (i.e. 1GB) to prevent any overflow issue due to long rows
    • slow_query_log – set to OFF to turn off the slow query log. This will eliminate the overhead causing by slow query logging
    • query_store_capture_mode – set both to NONE to turn off the Query Store. This will eliminate the overhead causing by sampling activities by Query Store.
    • innodb_buffer_pool_sizeInnodb_buffer_pool_size can only be increased by scaling up compute for Azure Database for MySQL server. Scale up the server to 64 vCore General Purpose SKU from the Pricing tier of the portal during migration to increase the innodb_buffer_pool_size.
    • innodb_io_capacity & innodb_io_capacity_max - Change to 9000 from the Server parameters in Azure portal to improve the IO utilization to optimize for migration speed.
    • innodb_write_io_threads & innodb_write_io_threads - Change to 4 from the Server parameters in Azure portal to improve the speed of migration.
    • Scale up Storage tier – The IOPs for Azure Database for MySQL server increases progressively with the increase in storage tier.
      • In the Single Server deployment option, for faster loads, we recommend increasing the storage tier to increase the IOPs provisioned.
      • In the Flexible Server deployment option, we recommend you scale (increase or decrease) IOPS irrespective of the storage size.

 

Conclusion

With this post, I’ve attempted to provide the detail you need to understand how to perform an online migration from AWS RDS MySQL to Azure Database for MySQL by using Azure DMS. Be sure that you set up the perquisites appropriately and consider all best practices for the best chances of a successful migration.

 

If you have any feedback or questions about the information provided above, please leave a comment below or email us at AskAzureDBforMySQL@service.microsoft.com. Thank you!

Version history
Last update:
‎Dec 04 2023 03:01 PM
Updated by: