A data synchronization component replicates data from data sources in each unit. This process follows specified data protection rules to handle different proportions of read and write traffic, ensuring eventual consistency of data across all units. If a unit becomes abnormal or unavailable, you can use the traffic shifting component to quickly shift traffic from the affected unit to healthy units, ensuring business continuity and stability.
Prerequisites
For a MySQL data layer, ensure the following requirements are met:
You have created one or more MySQL instances with identical names in two units. For more information, see (Deprecated, redirected to "Step 1") Quickly create an RDS for MySQL instance.
You have established a synchronization link between the source and destination MySQL instances, and the link status is Synchronizing. For more information, see Configure a synchronization task (legacy console).
For a DRDS data layer, ensure the following requirements are met:
You have created one or more DRDS instances with identical names in two unit environments. For more information, see Create a DRDS instance.
You have established a synchronization link between the source and destination DRDS instances, and the link status is Synchronizing. For more information, see Configure a synchronization task (legacy console).
For a PolarDB for MySQL or PolarDB for Oracle data layer, you must Create a PolarDB cluster.
For a PostgreSQL data layer, ensure the following requirements are met:
You have created one or more PostgreSQL instances with identical names in two unit environments. For more information, see Create an RDS for PostgreSQL instance.
You have established a synchronization link between the source and destination PostgreSQL instances, and the link status is Synchronizing. For more information, see Configure a synchronization task (legacy console).
Background information
Data protection rules include three types: Copy, Unit, and Mix.
Copy: Use this for data sources that require strong consistency. It establishes a one-way synchronization link to replicate data.
Unit: Use this for data sources that require eventual consistency. It establishes a bidirectional synchronization link.
Mix: For data sources that contain a mix of services requiring strong consistency, eventual consistency, and non-multi-active services. It allows you to control data write restrictions at the table level.
Access the configuration page
Log on to the Multi-active Service for High Availability (MSHA) console.
In the left-side navigation pane, click Multi-active Instance to go to the Multi-active Instance list page.
On the Multi-active Instance list page, find the target multi-active instance and click its ID to go to the Instance Overview page.
In the left-side navigation pane, click Data Layer Configuration to open the data layer configuration page.
Step 1: Create a data source
On the Data Layer Configuration page, click Manage Data Sources.
On the Data Source List page, click Add Data Source, configure the parameters, and then click Submit.
Parameter
Description
Example
Data Source Name
The name of the database that your multi-active application connects to. This must be specific to the database level.
Hangzhou-Merchant-Trade-DB
Data Source Unit
Select the unit where the data source is located. The region of this unit must match the region of the database instance.
Hangzhou Central Unit
Data Source Type
The type of database that your multi-active application connects to. Supported types include PolarDB for MySQL, DRDS, MySQL, PostgreSQL, PolarDB for Oracle, and PolarDB-X 2.0.
MySQL
Instance Type
The available instance types vary based on the selected Data Source Type. Different instance types require different configurations. Follow the instructions on the console to configure the parameters.
RDS
Push Type
A unique identifier for the database used by your application when using the MSHA data plane SDK or Agent. The following two methods are available:
Instance and Database Configuration: Add the following suffix to the database connection configuration in your application code.
jdbc:mysql://host:port/dbName?mshaInstanceId=${instanceId}&mshaDbName=${dbName}NoteReplace
${instanceId}and${dbName}with the actual instance ID and database name from the management console.Instance and Database URL: No modifications to your application code are required.
NoteIf the data source has multiple JDBC URLs, separate them with a comma (,).
Instance and Database URL
Push Identifier
Required when the push type is Instance and Database URL. When the data protection rule takes effect after being pushed, this value serves as a unique identifier to distinguish between different data sources used by your application.
jdbc:mysql://host_01:port/dbName,jdbc:mysql://host_02:port/dbNameAfter the data source is created, you can view it on the Data Source List page.
Optional: You can also perform the following operations on the Data Source List page:
View data source status: The status of the most recent task to update table metadata. A metadata update task runs by default after you create a data source.
Possible statuses include:
Creating: The initial status of a data source before its metadata update task runs.
Normal: The most recent metadata update task was successful.
Loading table data: The metadata update task is in progress.
Load failed: The most recent metadata update task failed.
View data source details: In the Actions column, click Details to view detailed information about the data source.
View tables: In the Actions column, click View Tables to view table information, update the data source, and check the latest update status.
Update data source: In the Actions column, click Update to fetch the latest table metadata.
Delete data source: In the Actions column, click Delete, and then click OK in the confirmation dialog box.
(Optional) Step 2: Add a synchronization task
A bidirectional synchronization task includes both a forward and a reverse synchronization link, while a unidirectional synchronization task includes only a forward link.
Before adding a synchronization task, you must add another data source named Beijing-Merchant-Trade-DB to serve as the destination data source, using the method described in Step 1.
On the Data Layer Configuration page, click Manage Synchronization Link.
On the Synchronization Link List page, click Add Synchronization Task, configure the parameters, and then click Submit.
Parameter
Description
Example
Synchronization Task Name
Set a name for the synchronization task.
test-rds-forward
Source Data Source Type
The type of database that your multi-active application connects to. Supported types include:
DRDS
MySQL
PolarDB for MySQL
PolarDB for Oracle
PostgreSQL
PolarDB-X 2.0
MySQL
Source Data Source Unit
Select the unit where the source data source is located. This corresponds to the region of the source data source.
Hangzhou Central Unit
Source Data Source
Select the data source name you added in Step 1.
Hangzhou-Merchant-Trade-DB
Destination Data Source Type
The type of destination database that your multi-active application connects to. Supported types include:
DRDS
MySQL
PolarDB for MySQL
PolarDB for Oracle
PostgreSQL
PolarDB-X 2.0
MySQL
Destination Data Source Unit
Select the unit of the destination data source.
Beijing Unit
Destination Data Source
Select the name of the destination data source.
Beijing-Merchant-Trade-DB
Synchronization Task Type
Data Transmission Service (DTS) is supported.
DTS
Synchronization Topology
Specifies the synchronization topology, which can be unidirectional or bidirectional:
Unidirectional synchronization: To ensure data consistency, the synchronization objects in the destination instance are read-only.
Bidirectional synchronization: DTS currently supports bidirectional synchronization only between two MySQL databases.
NoteFor more information about synchronization topologies, see Introduction to data synchronization topologies.
Bidirectional synchronization
Synchronization Task Unit
The unit to which the synchronization task belongs. The task is created by default in the region where the destination instance is located.
Hangzhou Central Unit
Synchronization Task Creation Method
You can choose from the following creation methods:
Direct Entry: If you have already created a synchronization task in the Data Transmission Service (DTS) console whose status is Synchronizing (and the reverse link status is also Synchronizing for bidirectional tasks), you can select it directly.
Manual Creation: If you have created a synchronization task in the DTS console whose status is Not Configured (and the reverse link status is also Not Configured for bidirectional tasks), you can enter the task and then configure it later in the MSHA console.
NoteFor information about creating a synchronization task in the DTS console, see Overview of DTS data synchronization solutions.
Direct Entry
Synchronization Task
The synchronization task ID (name). Select a task that has already been created in the DTS console.
dtsp6s12ghvv74xb7m (test-forward)
After the synchronization link is created, you can view it on the Synchronization Link List page.
Optional: You can also perform the following operations on the Synchronization Link List page:
View synchronization link information: In the Actions column, click View to see the details of the synchronization link.
Modify synchronization object: In the Actions column, click Modify Synchronization Object to go to the Edit Synchronization Link page and modify the synchronization object.
Release task: Select a synchronization link, click Release Synchronization Task in the lower-left corner, and then click OK.
NoteA task cannot be released if it is being used by an active data protection rule.
For a bidirectional synchronization task, selecting either the forward or reverse link will release both links.
Pause task: Select the target synchronization link, click Pause Synchronization Task in the lower-left corner, and then click OK.
Start task: Select the target synchronization link, click Start Synchronization Task in the lower-left corner, and then click OK.
Update synchronization status: Asynchronously updates the synchronization status on the current synchronization link list page.
Step 3: Create a data protection rule
On the Data Layer Configuration page, click Create Data Protection Rule, configure the parameters, and then click Submit.
Parameter | Description | Example |
Data Protection Rule Name | Set a name for the protection rule. | test-rds |
Architecture Type | The default is geo-redundancy for geo-redundant architectures. | geo-redundancy |
Data Protection Rule Type | The type of data protection rule. The following three types are available:
| COPY |
Synchronization Latency Policy | This policy determines the behavior during traffic shifting if data replication is delayed:
| Prohibit Writes |
Data Protection Rule Table | This parameter is required when you set Data Protection Rule Type to MIX. The following table types are available:
| In this example, the data protection rule type is COPY, so this parameter is not required. |
Data Source Information | Click Select Data Source, select up to two data sources to protect in the dialog box, and click OK. After selecting the data sources, you can click View All Canary IP Addresses in the list and enter the private IP addresses of the ECS instances where your application is running. Separate multiple IP addresses with a comma (,). |
|
Synchronization Link | Select the matching synchronization link. | Merchant Trade Synchronization Link |
After the data protection rule is created, you can view it on the Data Layer Configuration page.
Next steps
You can also perform the following operations on the Data Layer Configuration page:
View basic data
In the Basic Data Overview section, you can view the total, normal, and abnormal counts for data sources, synchronization links, and data protection rules.
Type | Normal resources | Abnormal resources |
Data Source | The number of data sources with a Normal status. | The number of data sources with a status other than Normal. |
Synchronization Link | The number of synchronization links with a Synchronizing status. | The number of synchronization links with a status other than Synchronizing. |
Data Protection Rule | The number of data protection rules with an Effective status. | The number of data protection rules with a status other than Effective. |
Data protection rule status
In the Effective Status column of the data protection rule list, you can view the status of the rule.
Draft: The initial status of a new data protection rule, or the status after a canary push is rolled back.
Canary effective: The status after a successful canary push.
Effective: The status after a successful full push.
Push operations
Push Canary Rule: Select a rule and click Push Canary Rule at the bottom of the page. This applies the data protection rule to the data plane SDK and Agent for a limited scope. The scope is controlled by the canary IP addresses specified when creating the rule, which are the private IP addresses of the ECS instances hosting your application.
NoteYou can only perform a canary push on rules that are in the Draft status.
Push Full Rule: Select a rule and click Push Full Rule at the bottom of the page. This applies the data protection rule fully to the data plane SDK and Agent.
Delete Canary Rule: Select a rule and click Delete Canary Rule at the bottom of the page. This deactivates a data protection rule that has the Canary effective status.
Delete Full Rule: Select a rule and click Delete Full Rule at the bottom of the page. This deactivates a data protection rule that has the Effective status.
Degrade: Select a rule and click Degrade at the bottom of the page. This bypasses the multi-active logic for the application instances controlled by this data protection rule.
Cancel Degradation: Click Cancel Degradation at the bottom of the page to restore the multi-active logic for the application instances controlled by this data protection rule.
Other operations
In the Actions column of the data protection rule list, you can perform the following operations:
View or edit details: Click Details in the Actions column to view the details of a data protection rule. You can also edit certain details and then click Submit.
Push history: Click Push History in the Actions column. On the Push History page, click View in the Actions column to see the content of a historical push.
Delete rule: Click Delete in the Actions column to delete the rule.