This topic describes how to migrate an ApsaraDB RDS for MySQL instance across zones in the same region. The time that is required to complete the migration varies based on the amount of data that needs to be migrated. In most cases, the migration requires a few hours.

Prerequisites

For more information about how to migrate an RDS instance that runs a different database engine across zones in the same region, see the following topics:

Billing rules

You are not charged for the cross-zone migration. No fees are generated even if you migrate your RDS instance from one zone to multiple zones.

Impacts

  • If you migrate the RDS instance across zones in the same region, a transient connection that lasts approximately 30 seconds occurs during the migration. Make sure that your application is configured to automatically reconnect to the RDS instance.
  • The cross-zone migration causes changes to the virtual IP addresses of your RDS instance. We recommend that you use an endpoint rather than an IP address of your RDS instance to connect your application to your RDS instance.
  • After the cross-zone migration, you must immediately delete the cached DNS records from the database client. If the database client runs on a JVM, we recommend that you set the time-to-live (TTL) in the JVM configuration to 60 seconds or less. In this case, if the virtual IP address that is bound to the in-use endpoint of your RDS instance changes, your application can query the related DNS records again to obtain the new virtual IP address. Then, your application can connect to the new virtual IP address.
    Note For more information about how to set the TTL in the JVM configuration, see Class InetAddress.
  • If your RDS instance is attached to a DRDS instance, VIP changes may affect the connectivity between the RDS instance and the DRDS instance. We recommend that you fix connectivity issues at the earliest opportunity. For more information, see Fix database shard connections.
  • If your RDS instance has an ongoing Data Transmission Service (DTS) task, you must restart the DTS task after the migration is complete.
  • If the resource inventory in the zone to which you want to migrate your RDS instance is insufficient, the migration may fail.

Procedure

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the Basic Information section of the page that appears, view the region and zone of your RDS instance.
    • Example value of the Zone parameter for single-zone deployment. Single-zone Deployment
    • Example value of the Zone parameter for multi-zone deployment. Multi-zone Deployment
  3. Click Migrate Across Zones.
    Note If Migrate Across Zones is not displayed, you must check whether your RDS instance meets the prerequisites.
  4. In the Migrate Instance Across Zones dialog box, configure the To Primary Zone, To Secondary Zone, VSwitch in Primary Zone, VSwitch in Secondary Zone, and Switching Time parameters. Then, click OK. Single-zone Migration
    Migration scenarioDescription
    Migration from one zone to another zoneYou must set the To Primary Zone and To Secondary Zone parameters to the same value.

    For example, the primary RDS instance and the secondary RDS instance reside in Singapore Zone C, and you migrate the instances to Singapore Zone A.

    Migration from one zone to multiple zonesYou must set the To Primary Zone and To Secondary Zone parameters to different values.

    For example, the primary RDS instance and the secondary RDS instance reside in Singapore Zone C, and you migrate the primary RDS instance to Singapore Zone B and the secondary RDS instance to Singapore Zone A.

    Note After the migration, the primary and secondary RDS instances reside in different zones to achieve cross-zone disaster recovery.

    The multi-zone deployment method delivers higher disaster recovery capabilities than the single-zone deployment method. If you select the single-zone deployment method, your database system can withstand server and rack failures. If you select the multi-zone deployment method, your database system can withstand data center failures.

    If your database system contains primary and secondary RDS instances, we recommend that you migrate your RDS instance to multiple zones to implement cross-zone disaster recovery.

    Migration from multiple zones to one zoneYou must set the To Primary Zone and To Secondary Zone parameters to the same value.

    For example, the primary RDS instance resides in Singapore Zone B, the secondary RDS instance resides in Singapore Zone A, and you migrate the instances to Singapore Zone C.

    Important
    • After the migration, the system switches the workloads on your RDS instance over to the destination zones based on the time that is specified by the Switching Time parameter. You can set the Switching Time parameter to Migrate Immediately or Switch Within Maintenance Window. The switchover triggers a transient connection. Make sure that your application is configured to automatically reconnect to the RDS instance. Otherwise, you must manually reconnect your application to the RDS instance.
    • If the DNS records cached on the database client are not immediately updated after the migration, some workloads may be switched over to the destination zones 10 minutes later. As a result, the RDS instance encounters another transient connection. If the database client runs on a JVM, we recommend that you set the TTL in the JVM configuration to 60 seconds or less. In this case, if the virtual IP address that is bound to the in-use endpoint of the RDS instance changes, your application can query the related DNS records again to obtain the new virtual IP address. Then, your application can connect to the new virtual IP address. For more information, see the "Impacts" section of this topic.

Related operations

OperationDescription
Migrate an instance across zonesMigrates an instance across zones.

FAQ

  • If data is written to my RDS instance during cross-zone migration, is original data on the RDS instance affected after the workload switchover? Is the newly written data retained?
    Original data is not affected, and the newly written data is retained.
    Important During the migration, your RDS instance runs as expected. However, a transient connection may occur during the workload switchover. Make sure that your application is configured to automatically reconnect to the RDS instance. Otherwise, you must manually reconnect your application to the RDS instance after the workloads are switched over to the destination zone.
  • What factors affect the time that is required for cross-zone migration?

    The time that is required for cross-zone migration varies based on the amount of data on your RDS instance. If a large amount of data exists on the RDS instance, a long period of time is required.