From MySQL to MySQL (Dual-Active DR)
Supported Source and Destination Databases
Service database |
DR Database |
---|---|
|
|
Prerequisites
- You have logged in to the DRS console.
- For details about the supported DB types and versions, see Real-Time Disaster Recovery.
Suggestions
- During the DR initialization, do not perform DDL operations on the service database. Otherwise, the task may be abnormal.
- During DR initialization, ensure that no data is written to the DR database to ensure data consistency before and after DR.
- The success of DR depends on environment and manual operations. To ensure a smooth DR, perform a DR trial before you start the DR task to help you detect and resolve problems in advance.
- It is recommended that you start your DR task during off-peak hours to minimize the impact on your services.
- If the bandwidth is not limited, initialization of DR will increase query workload of the source database by 50 MB/s and occupy 2 to 4 vCPUs.
- To ensure data consistency, tables without a primary key may be locked for 3s during disaster recovery.
- The data in the DR process may be locked by other transactions for a long period of time, resulting in read timeout.
- If DRS concurrently reads data from a database, it will use about 6 to 10 sessions. The impact of the connections on services must be considered.
- If you read a table, especially a large table, during DR, the exclusive lock on that table may be blocked.
- Data-Level Comparison
To obtain accurate comparison results, start data comparison at a specified time point during off-peak hours. If it is needed, select Start at a specified time for Comparison Time. Due to slight time difference and continuous operations on data, data inconsistency may occur, reducing the reliability and validity of the comparison results.
Precautions
Before creating a DR task, read the following precautions:
- You are advised to create an independent database account for DRS task connection to prevent task failures caused by database account password modification.
- After changing the account passwords for the service or DR databases, modify the connection information in the DRS task as soon as possible to prevent automatic retry after a task failure. Automatic retry will lock the database accounts.
Type |
Restrictions |
---|---|
Database permissions |
|
Disaster recovery objects |
|
Service database configuration |
|
DR database configuration |
|
Precautions |
|
Procedure
- On the Disaster Recovery Management page, click Create Disaster Recovery Task.
- On the Create Disaster Recovery Instance page, specify the task name, description, and the DR instance details, and click Create Now.
- Task information description
Table 3 Task and recipient description Parameter
Description
Task Name
The task name must start with a letter and consist of 4 to 50 characters. It can contain only letters, digits, hyphens (-), and underscores (_).
Description
The description consists of a maximum of 256 characters and cannot contain special characters !=<>'&"\
- DR instance information
Table 4 DR instance settings Parameter
Description
DR Type
Select Dual-active.
The DR type can be single-active or dual-active. If Dual-active is selected, two subtasks are created by default, a forward DR task and a backward DR task.
Current Cloud RDS Instance Role
Select Active 1 or Active 2. This parameter specifies the role of the current RDS DB instance in the DR relationship and is available when DR Type is set to Dual-active. For details, see How Do I Select Active Database 1 and 2 for Dual-Active DR?
- Active 1: Initial data is available on the current cloud RDS when a task is created.
- Active 2: The RDS DB instance on the current cloud is empty when a task is created.
Active 2 is used as an example.
Service DB Engine
Select MySQL.
DR DB Engine
Select MySQL.
Network Type
The public network is used as an example.
Available options: VPN or Direct Connect and Public network. By default, the value is Public network.
DR DB Instance
The RDS for MySQL instance you created.
Disaster Recovery Instance Subnet
Select the subnet where the disaster recovery instance is located. You can also click View Subnet to go to the network console to view the subnet where the instance resides.
By default, the DRS instance and the destination DB instance are in the same subnet. You need to select the subnet where the DRS instance resides and ensure that there are available IP addresses. To ensure that the DR instance can be successfully created, only subnets with DHCP enabled are displayed.
If a task fails to be created, DRS retains the task for three days by default. After three days, the task automatically ends.
- Task information description
- On the Disaster Recovery Management page, after the task is created, locate the forward subtask and click Edit in the Operation column. The Configure Source and Destination Databases page is displayed.
- On the Configure Source and Destination Databases page, wait until the DR instance is created. Then, specify source and destination database information and click Test Connection for both the source and destination databases to check whether they have been connected to the DR instance. After the connection tests are successful, select the check box before the agreement and click Next.
Table 5 Service database settings Parameter
Description
Source Database Type
By default, Self-built on ECS is selected.
IP Address or Domain Name
The IP address or domain name of the service database.
Port
The port of the service database. Range: 1 – 65535
Database Username
The username for accessing the service database.
Database Password
The password for the service database username. You can change the password if necessary. To change the password, perform the following operation after the task is created:
If the task is in the Starting, Initializing, Disaster recovery in progress, or Disaster recovery failed status, in the Connection Information area on the Basic Information tab, click Modify Connection Details. In the displayed dialog box, change the password.
SSL Connection
SSL encrypts the connections between the source and destination databases. If SSL is enabled, upload the SSL CA root certificate.
NOTE:- The maximum size of a single certificate file that can be uploaded is 500 KB.
- If SSL is disabled, your data may be at risk.
The IP address, domain name, username, and password of the service database are encrypted and stored in DRS and will be cleared after the task is deleted.
Table 6 DR database settings Parameter
Description
DB Instance Name
The RDS for MySQL instance you selected when you create the DR instance. The instance name cannot be changed.
Database Username
The username for accessing the DR database.
Database Password
The password for the database username. The password can be changed after a task is created.
If the task is in the Starting, Initializing, Disaster recovery in progress, or Disaster recovery failed status, in the Connection Information area on the Basic Information tab, click Modify Connection Details. In the displayed dialog box, change the password.
The database username and password are encrypted and stored in DRS, and will be cleared after the task is deleted.
SSL Connection
If SSL connection is required, enable SSL on the DR database, ensure that related parameters have been correctly configured, and upload an SSL certificate.
NOTE:- The maximum size of a single certificate file that can be uploaded is 500 KB.
- If SSL is disabled, your data may be at risk.
- On the Configure DR page, specify flow control and click Next.
Table 7 DR settings Parameter
Description
Flow Control
You can choose whether to control the flow.
- Yes
You can customize the maximum DR speed.
In addition, you can set the time range based on your service requirements. The traffic rate setting usually includes setting of a rate limiting time period and a traffic rate value. Flow can be controlled all day or during specific time ranges. The default value is All day. A maximum of three time ranges can be set, and they cannot overlap.
The flow rate must be set based on the service scenario and cannot exceed 9,999 MB/s.
- No
The DR speed is not limited and the outbound bandwidth of the source database is maximally used, which causes read consumption on the source database accordingly. For example, if the outbound bandwidth of the source database is 100 MB/s and 80% bandwidth is used, the I/O consumption on the source database is 80 MB/s.NOTE:
- Flow control mode takes effect during the initial DR phase only.
- You can also change the flow control mode when the task is in the Configuration state. On the Basic Information tab, In the DR Information area, click Modify next to Flow Control. In the dialog box that is displayed, change the flow control mode. The flow control mode cannot be changed for a task that is in Starting state.
Migrate Definer to User
Indicates whether to migrate the Definers of all source database objects to the destination database user entered during the connection test.
- Yes
The Definers of all source database objects will be migrated to the user. Other users do not have permissions for database objects unless these users are authorized. For details on authorization, see How Do I Maintain the Original Service User Permission System After Definer Is Forcibly Converted During MySQL Migration?
- No
The Definers of all source database objects will not be changed. You need to migrate all accounts and permissions of the source database in the next step. Note that if the Definer account is not found in the destination database, unavailable objects will be created.
- Yes
- On the Check Task page, check the DR task.
- If any check fails, review the failure cause and rectify the fault. After the fault is rectified, click Check Again.
For details about how to handle check items that fail to pass the pre-check, see Solutions to Failed Check Items.
- If the check is complete and the check success rate is 100%, click Next.
You can proceed to the next step only when all checks are successful. If there are any items that require confirmation, view and confirm the details first before proceeding to the next step.
- If any check fails, review the failure cause and rectify the fault. After the fault is rectified, click Check Again.
- On the displayed page, specify Start Time for the forward subtask. After confirming that the configured information is correct, click Submit to submit the forward DR task.
Table 8 Task and recipient description Parameter
Description
Start Time
Set Start Time to Start upon task creation or Start at a specified time based on site requirements.
NOTE:After a DR task is started, the performance of the service and DR databases may be affected. You are advised to start a DR task during off-peak hours.
- Return to the Disaster Recovery Management page. After the forward subtask enters the Disaster recovery in progress state, locate the backward subtask and click Edit in the Operation column. The Configure Source and Destination Databases page of the backward subtask is displayed.
- On the Configure Source and Destination Databases page, click Test Connection for both the source and destination databases to check whether they have been connected to the DR instance. After the connection tests are successful, click Next.
- On the displayed page, specify Start Time for the backward subtask. After confirming that the configured information is correct, click Submit to submit the backward DR task.
- After the task is submitted, view and manage it on the Disaster Recovery Management page.
- You can view the task status. For more information about task status, see Task Statuses.
- You can click in the upper-right corner to view the latest task status.
- By default, DRS retains any task in the Configuration state for three days. After three days, DRS automatically deletes background resources, but the task status remains unchanged. When you reconfigure the task, DRS applies for resources again.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot