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
The RDS instance meets the following requirements:
The RDS instance runs RDS High-availability Edition or RDS Basic Edition. Serverless RDS instances are not supported.
The RDS instance does not use a phased-out instance type. For more information, see Instance types for standard primary ApsaraDB RDS for MySQL instances (original x86 architecture). For more information about how to change the instance type, see Change instance specifications.
The RDS instance is in the Running state.
NoteIf your RDS instance has read-only RDS instances, make sure that the read-only RDS instances are in the Running state. Otherwise, the
OperationDenied.MasterDBlnstancestate
error message is displayed when you migrate the RDS instance to another zone.
If your RDS instance uses cloud disks, the minor engine version of your RDS instance is 20201031 or later. For more information about how to update the minor engine version of an RDS instance, see Update the minor engine version.
The region in which your RDS instance resides consists of multiple zones. For more information about the regions and zones of Alibaba Cloud, see Regions and zones.
The network connection mode of your RDS instance is upgraded. For more information, see [Product changes/Feature changes] The network connection mode of an ApsaraDB RDS instance is upgraded.
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. This applies even if you migrate your RDS instance from one zone to multiple zones.
Impacts
During the migration, an instance switchover occurs. Make sure that your application is configured to automatically reconnect to your RDS instance. For more information, see Impacts of an instance switchover.
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 Java virtual machine (JVM), we recommend that you set the time-to-live (TTL) in the JVM configuration to 60 seconds or less. This way, if the VIP 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 VIP. Then, your application can connect to the new VIP.
NoteFor more information about how to set the TTL in the JVM configuration, see Class InetAddress.
If your RDS instance is attached to a PolarDB-X 1.0 instance, VIP changes may affect the connectivity between the RDS instance and the PolarDB-X 1.0 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.
A table is recreated when you perform cross-zone migration. As a result, the creation time of the table is changed, and the value of the CREATE_TIME field in the INFORMATION_SCHEMA table is changed.
Procedure
- 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.
In the Basic Information section of the page that appears, view the region and zone of your RDS instance.
Example value of the Region and Zone parameter for single-zone deployment Basic Information
Example value of the Region and Zone parameter for multi-zone deployment method Basic Information
Click Migrate Data Across Zones.
NoteIf Migrate Data Across Zones is not displayed, you must check whether your RDS instance meets the prerequisites.
In the Migrate Instance Across Zones dialog box, configure the Configure Primary Zone, vSwitch in Primary Zone, and Switching Time parameters. Then, click Yes.
Migration scenario
Description
Migration from one zone to another zone
You must set the To Primary Zone and Configure Secondary Zone 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 toSingapore Zone A
.Migration from one zone to multiple zones
You must set the Configure Primary Zone and Configure 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 toSingapore Zone B
and the secondary RDS instance to Singapore Zone A.NoteAfter 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 zone
You must set the Configure Primary Zone and Configure Secondary Zone 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 toSingapore Zone C
.ImportantAfter the migration, the system switches your workloads based on the value of the Switching Time parameter. You can set the Switching Time parameter to Switch Immediately or Switch Within Maintenance Window. If the vSwitch of the RDS instance is changed during the switchover, the RDS instance is connected over new connections. 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 primary zone 10 minutes later. As a result, the RDS instance encounters another instance 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. 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 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. For more information, see the Impacts section of this topic.
For more information about the impacts of an instance switchover, see Impacts of an instance switchover.
Related operations
Operation | Description |
Migrates 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.
ImportantAn instance switchover occurs during the migration. 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. For more information about the impacts of an instance switchover, see Impacts of an instance switchover.
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.