This topic describes how to create a disaster recovery ApsaraDB RDS for MySQL instance for a primary ApsaraDB RDS for MySQL instance. A disaster recovery RDS instance resides in a different region than the region where its primary RDS instance resides. If your primary RDS instance is used for business scenarios in which high data reliability or compliance with financial regulations is required, you can create a disaster recovery RDS instance to increase data reliability.

Prerequisites

  • Your primary RDS instance runs one of the following MySQL versions and RDS editions:
    • MySQL 8.0 on RDS High-availability Edition or RDS Enterprise Edition
    • MySQL 5.7 on RDS High-availability Edition or RDS Enterprise Edition
    • MySQL 5.6
  • Your primary RDS instance resides in the classic network. If your primary RDS instance resides in a virtual private cloud (VPC), you must change the network type of your primary RDS instance from VPC to classic network. For more information, see Change the network type of an ApsaraDB RDS for MySQL instance.
  • Your primary RDS instance resides in one of the following regions: China (Hangzhou), China (Shanghai), China (Qingdao), China (Beijing), China (Shenzhen), China (Hong Kong), Singapore (Singapore), and US (Virginia).

Background information

A primary RDS instance and its disaster recovery RDS instance synchronize data with each other in real time by using Data Transmission Service (DTS). The primary RDS instance and the disaster recovery RDS instance are configured as a high-availability architecture. If the primary RDS instance and the secondary RDS instance are inaccessible due to unexpected exceptions such as natural disasters, the database system fails over to the disaster recovery RDS instance. In this case, the disaster recovery RDS instance is promoted to run as the new primary RDS instance. After you update the endpoint information on the application that is connected to the database system, the application immediately connects to the new primary RDS instance.

In the DTS console, you can specify the synchronization settings for a disaster recovery RDS instance. For example, you can change the objects that you want to synchronize, specify the synchronization speed, and configure the synchronization link to report alerts at a specified latency. For more information, see What is DTS?

The following figure shows the topology of a database system that contains a disaster recovery RDS instance.

Topology of a database system that contains a disaster recovery RDS instance

A disaster recovery RDS instance has the following characteristics:

  • A disaster recovery RDS instance is connected over an independent endpoint. You can configure an application to connect to the endpoint of a disaster recovery RDS instance.
  • A disaster recovery RDS instance runs in a high-availability architecture.
  • You are charged for a disaster recovery RDS instance based on the pay-as-you-go billing method.
  • You can configure IP address whitelists and manage accounts on a disaster recovery RDS instance.

Billing

  • By default, a disaster recovery RDS instance has the same configuration as its primary RDS instance and uses the pay-as-you-go billing method. For more information, visit the ApsaraDB RDS buy page.
  • By default, the DTS data synchronization link between a disaster recovery RDS instance and its primary RDS instance uses the small specification and the pay-as-you-go billing method. For more information, visit the DTS Price Calculator.

Limits

  • A disaster recovery RDS instance does not support backup and restoration, data migration, database management, public endpoints, or endpoint modifications.
  • A disaster recovery RDS instance does not synchronize database deletion operations from its primary RDS instance. After you delete a database from the primary RDS instance, you must log on to the disaster recovery RDS instance and then execute SQL statements to delete the database.

Procedure

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the Distributed by Instance Role section of the Basic Information page, click Add to the right of DR Instance. If you are using the original ApsaraDB RDS console, click Add Guard in the Distributed by Instance Role section of the Basic Information page.
    Note If the preceding entry points cannot be found, you must check whether the primary RDS instance meets all prerequisites that are specified in this topic.
  3. In the Create Data Synchronization Task wizard, configure the Database Account and Database Password parameters.
    Note
    • The account must have the REPLICATION SLAVE permission, the REPLICATION CLIENT permission, and the SELECT permission on all objects that you want to synchronize.
    • If you are using MySQL 5.6, you do not need to set the Database Account parameter or the Database Password parameter. You can skip this step.
  4. Click Buy Instance.
  5. In the Purchase Secondary Instance for Disaster Recovery dialog box, select a region and click Purchase.
    Note
    • You can specify only the region where the disaster recovery RDS instance resides. The disaster recovery RDS instance supports only the pay-as-you-go billing method. All the other settings of the disaster recovery RDS instance are the same as the settings of the primary RDS instance. After the disaster recovery RDS instance is created, you can change its specifications in the ApsaraDB RDS console.
    • ApsaraDB RDS requires a few minutes to create the disaster recovery RDS instance. Do not close the dialog box until the disaster recovery RDS instance is created. If you close the dialog box before the disaster recovery RDS instance is created, the disaster recovery RDS instance may fail to be created.
    • The billing method of the DTS synchronization link defaults to pay-as-you-go. When you create the DTS synchronization link, you cannot select the subscription billing method for the DTS synchronization link. However, after the DTS synchronization link is created, you can change the billing method of the DTS synchronization link to subscription to reduce costs. For more information, see Switch the billing method from pay-as-you-go to subscription.
  6. After the disaster recovery RDS instance is created, click Create account next to Instance ID in the Destination Instance Details section to create a privileged account that is used to synchronize data.
    Note If you are using MySQL 5.6, a privileged account is automatically created. Therefore, you can skip this step.
    Create account
  7. In the Create Data Synchronization Task wizard, configure the Database Account and Database Password parameters in the Destination Instance Details section. Then, click Set Whitelist and Next.
    Note If you are using MySQL 5.6, click Set Whitelist and Next. Wait until the account is created. Then, click Next.
  8. In the Available section, select the objects that you want to synchronize. Click the > icon to move the selected objects to the Selected section. Then, click Next.
    Note If you want to change the names of multiple tables at a time, you can select the tables, select Change Database and Table Names, and then click Advanced Settings. Change multiple table names at a time
    Select objects
  9. Set the Initial Synchronization parameter and click Precheck.
    Note During the Initial Synchronization process, DTS synchronizes the schemas and data of the selected objects from the primary RDS instance to the disaster recovery RDS instance. Later, DTS synchronizes the incremental data of the primary RDS instance to the disaster recovery RDS instance based on the schemas and the data. You can select the Initial Schema Synchronization option or the Initial Full Data Synchronization option. If you synchronize data for the first time, you must select both options.
    Initialize synchronization
  10. View the check items. This step is required only when the precheck fails. If the precheck is successful, go to Step 14.

    Click the icon next to Failed for each failed check item to view the details about the failure. Then, troubleshoot the issues that cause the failure.

    Precheck failed
  11. On the Synchronization Tasks page, find the created synchronization task and click Start Task.
    Perform synchronization again
  12. After you verify that the precheck is successful, click Close. The synchronization task starts.
    Precheck successful
  13. On the Synchronization Tasks page, view and manage the synchronization task that is created. For example, you can change the objects that you want to synchronize, specify the monitoring and alerting settings, and change the synchronization speed. For more information, see What is DTS?
    Note To ensure that the data on the disaster recovery RDS instance is up-to-date, do not pause the synchronization task.

FAQ

  • What benefits does the disaster recovery RDS instance of my database system bring?
    If the primary RDS instance and the secondary RDS instance are inaccessible due to unexpected exceptions such as natural disasters, your database system fails over to the disaster recovery RDS instance. In this case, the disaster recovery RDS instance is promoted to run as the new primary RDS instance. After you update the endpoint information on the connected application, the application immediately connects to the new primary RDS instance.
    Note Data that is written to the new primary RDS instance cannot be synchronized to the original primary RDS instance.
  • Can I select the subscription billing method for disaster recovery RDS instances?

    No, disaster recovery RDS instances support only the pay-as-you-go billing method.

  • Why do I find an account named dtssyncwriter that I did not create?

    If you are using MySQL 5.6, an account named dtssyncwriter is automatically created when you create a disaster recovery RDS instance. The dtssyncwriter account is used by DTS to synchronize data. Do not modify or delete this account. If you modify or delete this account, synchronization errors occur.