Data Transmission Service (DTS) lets you synchronize data from ApsaraDB RDS for MySQL to a self-managed Doris database for large-scale analytics. This topic covers source and destination configuration, synchronization types, limitations, and precheck steps. The example uses an ApsaraDB RDS for MySQL instance as the source and a Doris database deployed on an ECS instance as the destination.
Prerequisites
Before you begin, make sure that:
-
A destination Doris database is created. Its available storage space must exceed the storage used by the source RDS MySQL instance.
-
The source and destination database accounts have the required permissions. See Permissions required for database accounts.
For supported source and destination database versions, see Overview of data synchronization solutions.
Billing
| Synchronization type | Fee |
|---|---|
| Schema synchronization and full data synchronization | Free |
| Incremental data synchronization | Charged. See Billing overview. |
SQL operations supported for incremental synchronization
| Type | SQL statement |
|---|---|
| DML | INSERT, UPDATE, DELETE |
| DDL | ADD COLUMN, MODIFY COLUMN, CHANGE COLUMN, DROP COLUMN, DROP TABLE, TRUNCATE TABLE, RENAME TABLE |
The RENAME TABLE operation can cause data inconsistency. If you selected a specific table as the synchronization object and then rename it, DTS stops synchronizing data for that table. To prevent this, select the database as the synchronization object instead of the table, and make sure both the pre-rename and post-rename databases are included in the synchronization scope.
Permissions required for database accounts
| Database | Required permissions | How to grant |
|---|---|---|
| Source ApsaraDB RDS for MySQL | Read and write permissions on the objects to be synchronized | Create an account, Modify account permissions |
| Destination Doris database | Usage_priv, Select_priv, Load_priv, Alter_priv, Create_priv, Drop_priv | Authentication and authorization |
If the source database account was not created and authorized in the ApsaraDB RDS for MySQL console, make sure it has the REPLICATION CLIENT, REPLICATION SLAVE, SHOW VIEW, and SELECT permissions.
Limitations
Source database requirements
Table constraints
-
Tables without PRIMARY KEY or UNIQUE constraints: select Schema Synchronization for Synchronization Types and duplicate for Engine in the Configurations for Databases, Tables, and Columns step. DTS adds extra columns to destination tables during schema synchronization. See Additional columns.
Scale limits
-
When synchronizing at the table level with object name editing (such as table or column name mapping), a single task supports a maximum of 1,000 tables. If you exceed this limit, split the objects across multiple tasks or synchronize the entire database.
Binary log requirements
Binary logging is enabled by default for ApsaraDB RDS for MySQL. Check and configure the following parameters before starting the task:
| Parameter | Required value | Notes |
|---|---|---|
binlog_row_image |
full |
The precheck fails if this is not set to full. See Set instance parameters. |
| Binary log retention (RDS MySQL) | At least 3 days (7 days recommended) | A shorter retention period may cause task failure, data inconsistency, or data loss. Such issues are not covered by the DTS SLA. See Automatically delete local logs. |
| Binary log retention (self-managed MySQL) | At least 7 days | Same risks apply as above. |
If the source is a self-managed MySQL database:
-
Enable binary logging and set
binlog_formattorowandbinlog_row_imagetofull. -
For a primary/primary architecture (where both nodes act as primary and secondary for each other), enable
log_slave_updatesso DTS can read all binary logs. See Create a database account for a self-managed MySQL database and configure binary logging.
DDL restrictions
-
Do not perform DDL schema changes during initial schema synchronization or initial full data synchronization. This causes the task to fail.
-
Data changes from operations not recorded in binary logs (such as physical backup recovery and cascade operations) are not synchronized. If this occurs, remove the affected object from the synchronization scope and add it back. See Modify synchronization objects.
MySQL 8.0.23+ invisible columns
If the source runs MySQL 8.0.23 or later, invisible columns cause data loss because DTS cannot read their values. Run the following command to make invisible columns visible before starting the task:
ALTER TABLE <table_name> ALTER COLUMN <column_name> SET VISIBLE;
Tables without a primary key automatically generate an invisible primary key — make that visible as well. See Invisible Columns and Generated Invisible Primary Keys.
Destination database requirements
Supported Doris storage models
DTS can only write to tables that use the Unique Key model or Duplicate Key model in Doris.
When the destination table uses the Duplicate Key model, DTS converts UPDATE and DELETE statements to INSERT statements. Duplicate data may appear in the following situations:
-
A retry occurred in the synchronization instance.
-
The synchronization instance restarted.
-
Two or more DML operations were performed on the same row after the task started.
To deduplicate, use the additional columns _is_deleted, _version, and _record_id. See Additional columns.
Naming requirements
-
Doris only accepts database and table names that start with a letter. Use the object name mapping feature to rename any object whose name starts with a non-letter character.
-
If a database name, table name, or column name contains Chinese characters, use object name mapping to rename it (for example, translate it to English). Otherwise, the task may fail.
Operational restrictions
-
Do not create clusters in the destination Doris database during synchronization. This causes the task to fail. Restart the synchronization instance to resume.
-
Do not add backend (BE) nodes to the Doris database during synchronization. This causes the task to fail. Restart the synchronization instance to resume.
-
Do not modify DDL operations on multiple columns at once, or run consecutive DDL changes on the same table.
Multi-table merge
When merging data from multiple source tables into a single destination table, all source tables must have the same schema. Schema mismatches cause data inconsistency or task failures.
VARCHAR length mapping
MySQL VARCHAR(M) measures character length; Doris VARCHAR(N) measures byte length. If you are not using DTS schema synchronization, set the Doris VARCHAR field length to 4 times the corresponding MySQL VARCHAR length.
Online DDL restrictions
| Tool | Behavior |
|---|---|
| DMS or gh-ost | DTS synchronizes only the original DDL statements, not temporary table data. Destination tables may be locked temporarily. |
| pt-online-schema-change | Not supported. Using pt-online-schema-change on the source may cause data loss or task failure. |
Performance and latency
-
During initial full data synchronization, DTS consumes read and write resources on both source and destination databases. Run the synchronization during off-peak hours when the CPU load is below 30%.
-
Concurrent INSERT operations during full data synchronization create table fragmentation in the destination. The destination storage usage will be larger than the source after full sync completes.
-
During incremental synchronization, DTS uses a batch policy: by default, it writes to each synchronization object at most once every 5 seconds, resulting in a normal latency of under 10 seconds. To reduce latency, adjust the
selectdb.reservoir.timeout.millisecondsparameter (range: 1,000–10,000 milliseconds) in the DTS console.A shorter batch interval increases write frequency, which may raise the load and response time (RT) of the destination database and increase latency. Adjust based on destination database load.
-
Write to the destination database only through DTS during synchronization. Writing from other sources causes data inconsistency.
Encryption support
| Feature | Supported synchronization types |
|---|---|
| Transparent Data Encryption (TDE) | Schema synchronization, full data synchronization, incremental data synchronization |
| Always-Confidential (EncDB) | Initial full data synchronization is not supported. |
Instance recovery
If a DTS instance fails, the DTS team attempts recovery within 8 hours. Recovery may involve restarting the instance or adjusting DTS instance parameters. Database parameters are not modified. For parameters that may be adjusted, see Modify instance parameters.
Special cases
Self-managed MySQL source
-
If a primary/secondary failover occurs during synchronization, the task fails.
-
Latency is calculated as the difference between the timestamp of the last synchronized record and the current time. If no DML operations occur on the source for an extended period, the displayed latency may be inaccurate. Perform a DML operation on the source to refresh the latency display. Alternatively, if you choose to synchronize the entire database, you can create a heartbeat table that is updated every second.
-
DTS periodically runs
CREATE DATABASE IF NOT EXISTS \test\`` on the source to advance the binary log offset. -
If the source is an Amazon Aurora MySQL instance or a similar clustered MySQL instance, make sure the domain name or IP address configured for the task always resolves to the read/write (RW) node.
ApsaraDB RDS for MySQL source
-
ApsaraDB RDS for MySQL instances that do not record transaction logs — such as read-only instances of ApsaraDB RDS for MySQL 5.6 — cannot be used as a source.
-
DTS periodically runs
CREATE DATABASE IF NOT EXISTS \test\`` on the source to advance the binary log offset.
Create a synchronization task
Step 1: Open the Data Synchronization page
Use one of the following methods to go to the Data Synchronization page:
DTS console
-
Log on to the DTS console.
-
In the left-side navigation pane, click Data Synchronization.
-
In the upper-left corner, select the region where the synchronization instance resides.
DMS console
The exact navigation path may vary based on DMS console mode and layout. See Simple mode and Customize the layout and style of the DMS console.
-
Log on to the DMS console.
-
In the top navigation bar, move the pointer over Data + AI and choose DTS (DTS) > Data Synchronization.
-
From the drop-down list next to Data Synchronization Tasks, select the region where the synchronization instance resides.
Step 2: Configure source and destination databases
Click Create Task, then configure the following parameters:
| Category | Parameter | Description |
|---|---|---|
| N/A | Task Name | DTS generates a name automatically. Specify a descriptive name to make the task easy to identify. Uniqueness is not required. |
| Source Database | Select Existing Connection | If the instance is registered with DTS, select it from the list and DTS populates the connection parameters automatically. Otherwise, configure the following parameters manually. |
| Database Type | Select MySQL. | |
| Access Method | Select Alibaba Cloud Instance. | |
| Instance Region | Select the region of the source RDS MySQL instance. | |
| Replicate Data Across Alibaba Cloud Accounts | Select No when the source and destination are in the same Alibaba Cloud account. | |
| RDS Instance ID | Select the ID of the source RDS MySQL instance. | |
| Database Account | Enter the database account. See Permissions required for database accounts. | |
| Database Password | Enter the password for the database account. | |
| Encryption | Select Non-encrypted or SSL-encrypted. To use SSL encryption, enable SSL on the RDS MySQL instance first. See Use a cloud certificate to enable SSL encryption. | |
| Destination Database | Select Existing Connection | If the instance is registered with DTS, select it from the list. Otherwise, configure the following parameters manually. |
| Database Type | Select Doris. | |
| Access Method | Select Self-managed Database on ECS. For other connection types, complete the corresponding preparations first. See Preparations. | |
| Instance Region | Select the region of the destination Doris database. | |
| ECS Instance ID | Select the ID of the ECS instance running the destination Doris database. If the Doris cluster spans multiple ECS instances (for example, BE or FE nodes on separate instances), add the DTS server CIDR blocks to the security rules of each ECS instance. | |
| Port Number | Enter the Doris service port. Default: 9030. | |
| Database Account | Enter the Doris database account. See Permissions required for database accounts. | |
| Database Password | Enter the password for the database account. |
Step 3: Test connectivity
Click Test Connectivity and Proceed. In the CIDR Blocks of DTS Servers dialog box, click Test Connectivity.
DTS server CIDR blocks must be added to the security settings of both source and destination databases before the test passes. See Add DTS server IP addresses to a whitelist.
Step 4: Configure synchronization objects
In the Configure Objects step, configure the following settings:
| Configuration | Description |
|---|---|
| Synchronization Types | Incremental Data Synchronization is selected by default. Also select Schema Synchronization and Full Data Synchronization to synchronize historical data first, then continue with incremental changes. Important
When synchronizing from MySQL to Doris, DTS converts data types. If you do not select Schema Synchronization, create Unique Key or Duplicate Key model tables in the destination Doris database in advance. See Data type mappings, Additional columns, and Unique Key Model. |
| Processing Mode of Conflicting Tables | Precheck and Report Errors (recommended): If a table with the same name exists in the destination, the precheck fails and the task does not start. To resolve name conflicts, use object name mapping. See Map table and column names. Ignore Errors and Proceed: Skips the check. If schemas match, records with the same primary key or unique key are overwritten by the source data. If schemas differ, data initialization may fail or only partial data is synchronized. Use with caution. |
| Capitalization of object names in destination instance | Controls the capitalization of database, table, and column names in the destination. Default: DTS default policy. See Specify the capitalization of object names in the destination instance. |
| Source Objects | Select databases or tables to synchronize, then click the icon to move them to Selected Objects. |
| Selected Objects | Right-click an object to rename it, filter rows with WHERE conditions, or select specific SQL operations. If Schema Synchronization is selected, only tables are supported, and you must set the bucket_count parameter: right-click the table, enable Parameter Settings, enter a positive integer for Value, and click OK. If you use object name mapping to rename an object, other objects that depend on it may fail to synchronize. |
Step 5: Configure advanced settings
Click Next: Advanced Settings and configure the following options:
| Configuration | Description |
|---|---|
| Dedicated Cluster for Task Scheduling | DTS uses the shared cluster by default. Purchase a dedicated cluster for higher stability. See What is a DTS dedicated cluster. |
| Retry Time for Failed Connections | How long DTS retries failed connections after the task starts. Range: 10–1,440 minutes. Default: 720. We recommend that you set this parameter to a value greater than 30 minutes. If multiple tasks share the same source or destination, the shortest retry time applies. DTS charges continue during retries. |
| Retry Time for Other Issues | How long DTS retries failed DDL or DML operations. Range: 1–1,440 minutes. Default: 10. We recommend that you set this parameter to a value greater than 10 minutes. This value must be less than the Retry Time for Failed Connections value. |
| Enable Throttling for Full Data Synchronization | Limits queries per second (QPS) and data transfer speed during full data synchronization to reduce source and destination load. Available only when Full Data Synchronization is selected. |
| Enable Throttling for Incremental Data Synchronization | Limits RPS and data transfer speed during incremental synchronization. |
| Whether to delete SQL operations on heartbeat tables of forward and reverse tasks | Yes: DTS does not write heartbeat table operations to the source. A synchronization latency may appear. No: DTS writes heartbeat table operations to the source, which may affect features such as physical backup and cloning. |
| Environment Tag | Attach an optional environment tag to the instance. |
| Configure ETL | Enable extract, transform, and load (ETL) to transform data during synchronization. See What is ETL? and Configure ETL in a data migration or data synchronization task. |
| Monitoring and Alerting | Configure alerts for task failures or latency exceeding a threshold. See Configure monitoring and alerting when you create a DTS task. |
(Optional) Click Next: Configure Database and Table Fields to specify Primary Key Column, Distribution Key, and Engine for each table. This step is available only when Schema Synchronization is selected.
Set Definition Status to All to view and edit all tables.
Primary Key Column supports multiple columns. Columns selected for Primary Key Column are also available for Distribution Key.
For tables without primary keys or UNIQUE constraints, select duplicate for Engine. Otherwise, the task may fail or data may be lost.
Step 6: Run the precheck
Click Next: Save Task Settings and Precheck.
To preview the API parameters for this task, hover over the button and click Preview OpenAPI parameters before proceeding.
DTS runs a precheck before the task starts. The task only starts after the precheck passes.
-
If the precheck fails, click View Details next to each failed item, fix the underlying issues, and then click Precheck Again.
-
If a precheck item triggers an alert:
-
Items that cannot be ignored: click View Details, fix the issue, and rerun the precheck.
-
Items that can be ignored: click Confirm Alert Details, click Ignore in the dialog box, click OK, and then click Precheck Again. Ignoring alerts may cause data inconsistency.
-
Step 7: Purchase the instance
-
Wait until Success Rate reaches 100%, then click Next: Purchase Instance.
-
On the purchase page, configure the following parameters:
| Parameter | Description |
|---|---|
| Billing Method | Subscription: pay upfront for a fixed term. More cost-effective for long-term use. Pay-as-you-go: billed hourly. Release the instance when no longer needed to avoid unnecessary charges. |
| Resource Group Settings | Assign the instance to a resource group. Default: default resource group. See What is Resource Management? |
| Instance Class | Select the class based on the required synchronization speed. See Instance classes of data synchronization instances. |
| Subscription Duration | Available for the subscription billing method. Options: 1–9 months, or 1, 2, 3, or 5 years. |
-
Read and accept the Data Transmission Service (Pay-as-you-go) Service Terms.
-
Click Buy and Start, then click OK in the confirmation dialog box.
The task appears in the task list. Monitor its progress from there.
Data type mappings
| MySQL type | Doris type | Notes |
|---|---|---|
| TINYINT | TINYINT | |
| TINYINT UNSIGNED | SMALLINT | |
| SMALLINT | SMALLINT | |
| SMALLINT UNSIGNED | INT | |
| MEDIUMINT | INT | |
| MEDIUMINT UNSIGNED | BIGINT | |
| INT | INT | |
| INT UNSIGNED | BIGINT | |
| BIGINT | BIGINT | |
| BIGINT UNSIGNED | LARGEINT | |
| BIT(M) | INT | |
| Decimal | Decimal | ZEROFILL is not supported. |
| Numeric | Decimal | |
| Float | Float | |
| Double | DOUBLE | |
| BOOL, BOOLEAN | BOOLEAN | |
| DATE | DATEV2 | |
| DATETIME[(fsp)] | DATETIMEV2 | |
| Timestamp[(fsp)] | DATETIMEV2 | |
| Time[(fsp)] | VARCHAR | |
| YEAR[(4)] | INT | |
| CHAR, VARCHAR | VARCHAR | Converted to VARCHAR(4*n) to avoid data loss. If no length is specified, defaults to VARCHAR(65533). If the length exceeds 65533, converted to STRING. |
| BINARY, VARBINARY | STRING | |
| TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT | STRING | |
| TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB | STRING | |
| ENUM | STRING | |
| SET | STRING | |
| JSON | STRING |
Additional columns
DTS automatically adds the following columns to destination tables that use the Duplicate Key model. For tables where DTS does not add them automatically, add these columns manually.
| Column name | Data type | Default value | Description |
|---|---|---|---|
_is_deleted |
Int | 0 | Indicates whether the row is deleted. INSERT and UPDATE: 0. DELETE: 1. |
_version |
Bigint | 0 | For full data: 0. For incremental data: the timestamp in seconds from the binary log of the source database. |
_record_id |
Bigint | 0 | For full data: 0. For incremental data: the unique, auto-incrementing record ID of the incremental log entry. |