Use Data Transmission Service (DTS) to migrate data from a PolarDB-X 1.0 instance to an Alibaba Cloud Elasticsearch cluster. DTS supports schema migration, full data migration, and incremental data migration, so you can migrate with zero or minimal downtime.
Prerequisites
Before you begin, make sure you have:
A PolarDB-X 1.0 instance (version 5.2 or later) that uses RDS for MySQL as the storage backend — either custom RDS instances or separately purchased RDS instances. PolarDB for MySQL is not supported.
A destination Alibaba Cloud Elasticsearch cluster (not a development or test specification). To create one, see Create an Alibaba Cloud Elasticsearch instance.
The destination Elasticsearch cluster has more storage space than the source PolarDB-X 1.0 instance.
Choose a migration strategy
Select the migration types that match your requirements:
| Goal | Migration types |
|---|---|
| One-time import with brief downtime | Schema migration + Full data migration |
| Smooth cutover with minimal downtime | Schema migration + Full data migration + Incremental data migration |
| Keep source writes running throughout migration | Schema migration + Full data migration + Incremental data migration |
Schema migration copies schema definitions from the source to the destination Elasticsearch cluster.
Full data migration copies all existing data from the selected objects.
Incremental data migration replicates ongoing changes after the full migration completes, keeping source and destination in sync until you cut over.
If you run only full data migration, stop writes to the source instance during migration to avoid data inconsistency.
Billing
| Migration type | Instance configuration fee | Internet traffic fee |
|---|---|---|
| Schema migration and full data migration | Free | Charged only when the destination Access Method is Public IP Address. See Billing overview. |
| Incremental data migration | Charged. See Billing overview. |
Understand the Elasticsearch data model
Elasticsearch uses a document-oriented model that differs from relational databases. Before migration, make sure your index structure is planned accordingly — unlike tables in a relational database, Elasticsearch indexes are not always one-to-one replacements.
DTS maps your relational structure to Elasticsearch as follows:
| Relational database | Elasticsearch |
|---|---|
| Database | Index |
| Table | Type |
| Row | Document |
| Column | Field |
| Database schema | Mapping |
During schema migration, DTS does not set the mapping parameter in dynamic. The behavior depends on your Elasticsearch instance settings. If your source data is in JSON format, make sure values for the same key share the same data type across all rows in a table — otherwise DTS may report synchronization errors. See dynamic in the Elasticsearch documentation.
Required database account permissions
| Database | Schema migration | Full migration | Incremental migration |
|---|---|---|---|
| PolarDB-X 1.0 (source) | SELECT | SELECT | Read and write on migration objects. See Account management. |
| Elasticsearch (destination) | Read and write | Read and write | Read and write |
The default Elasticsearch account is elastic.
Supported SQL operations for incremental migration
| Operation type | SQL statements |
|---|---|
| DML | INSERT, UPDATE, DELETE |
UPDATE operations that remove fields are not supported.
Limitations
Before you start
Review these limitations before configuring your migration task:
Tables to be migrated must have primary keys or UNIQUE constraints with unique field values. Otherwise, duplicate data may appear in the destination.
When migrating at the table level with column mapping, a single task supports a maximum of 1,000 tables. If you exceed this limit, split the tables into multiple batches and create a separate task for each batch, or configure the task to migrate an entire database.
PolarDB-X 1.0 read-only instances do not support data migration.
DTS does not support migrating INDEX, PARTITION, VIEW, PROCEDURE, FUNCTION, TRIGGER, or FK objects.
You cannot migrate data to an Elasticsearch index that has a parent-child relationship or a Join field type mapping. Attempting this may cause the task to fail or break data queries in the destination.
Timestamp fields with a value of
0in the source becomenullin the destination.
For incremental migration, binary logs must meet these requirements:
Binary logging must be enabled, and
binlog_row_imagemust be set tofull. If not, the precheck fails and the task cannot start.Binary log retention period: If the retention period is shorter than required, DTS may fail to retrieve binary logs. In extreme cases, this causes data inconsistency or data loss. Issues caused by insufficient log retention are not covered by the Service-Level Agreement (SLA).
Incremental migration only: at least 24 hours
Full migration + incremental migration: at least 7 days. After full migration completes, you can reduce this to 24 hours or more.
During migration
Avoid the following operations while the migration task is running:
On the source database: Do not perform scale-out, scale-in, hot spot table migration, shard key changes, or DDL operations. These cause the task to fail.
During full migration, DTS queries the source database, which creates a metadata lock that may block DDL operations on the source.
On the source database: DTS temporarily disables foreign key constraint checks and cascade operations at the session level. If you run cascade update or delete operations during migration, data inconsistency may occur.
On the source database: If you change the network type of the PolarDB-X 1.0 instance during migration, update the network connectivity settings in the migration task as well.
Schema changes: To add columns to tables in the source database, first update the corresponding mapping in the Elasticsearch instance, then run the DDL statement in the source, then pause and restart the migration task.
XA transaction consistency: DTS ensures data consistency for incremental migration based on the continuity of XA transactions in PolarDB-X 1.0. If XA transaction continuity is interrupted — for example, during a disaster recovery event for the incremental data collection module — uncommitted XA transactions may be lost.
After migration
Before switching production traffic to the destination, end or release the migration task. Alternatively, revoke write permissions for the DTS account on the destination using the
REVOKEcommand. This prevents automatic task recovery from overwriting destination data with source data.DTS attempts to auto-recover failed tasks for up to 7 days. DTS support staff will attempt to restore failed tasks within 8 hours. During restoration, they may restart the task or adjust task parameters (not database parameters). Parameters that may be adjusted are listed in Modify instance parameters.
Other notes
DTS periodically updates the dts_health_check.ha_health_check table in the source database to advance the binary log offset.
Configure a migration task
Step 1: Open the migration task list
Navigate to the Data Migration task list using one of the following methods.
From the DTS console
Log on to the Data Transmission Service (DTS) console.Data Transmission Service (DTS) console
In the left navigation pane, click Data Migration.
In the upper-left corner, select the region where the migration instance is located.
From the DMS console
Steps may vary based on the mode and layout of the DMS console. See Simple mode console and Customize the layout and style of the DMS console.
Log on to the Data Management (DMS) console.Data Management (DMS) console
In the top menu bar, choose Data + AI > Data Transmission (DTS) > Data Migration.
To the right of Data Migration Tasks, select the region where the migration instance is located.
Step 2: Create a task and configure connections
Click Create Task.
Configure the source database (PolarDB-X 1.0):
Parameter Description Task Name DTS generates a name automatically. Specify a descriptive name for easy identification. The name does not need to be unique. Select Existing Connection Select a previously added database instance from the drop-down list to auto-fill the connection details. If no saved instance exists, configure the parameters below manually. Database Type Select PolarDB-X 1.0. Connection Type Select Cloud instance. Instance Region Select the region where the source instance resides. Cross Alibaba Cloud account? Select Not cross-account if the source and destination are under the same Alibaba Cloud account. RDS instance ID Select the source PolarDB-X 1.0 instance ID. Database Account Enter the database account. See Required database account permissions. Database Password Enter the password for the database account. Configure the destination database (Elasticsearch):
Parameter Description Select Existing Connection Select a previously added database instance from the drop-down list to auto-fill the connection details. If no saved instance exists, configure the parameters below manually. Database Type Select Elasticsearch. Connection Type Select Cloud instance. Instance Region Select the region where the destination instance resides. Type Select Cluster or Serverless. Instance ID Select the destination Elasticsearch instance ID. Database Account Enter the logon name specified when creating the Elasticsearch instance. The default is elastic. Database Password Enter the password for the database account. Encryption Select HTTP or HTTPS. Click Test Connectivity and Proceed.
Make sure DTS server IP addresses are added to the security settings (whitelist) of both the source and destination databases. See Add DTS server IP addresses to a whitelist. If the source or destination uses a public IP address (that is, Access Method is not Alibaba Cloud Instance), also click Test Connectivity in the CIDR Blocks of DTS Servers dialog.
Step 3: Select migration objects
On the Configure Objects page:
Set the migration options:
Parameter Description Synchronization Type Select Schema Migration and Full Data Migration for a one-time migration. Add Incremental Data Migration to keep source and destination in sync during the migration period. See Choose a migration strategy. ImportantIf you do not select Schema Migration, you must ensure that a database and tables to receive the data already exist in the destination database.
Processing Mode for Existing Destination Tables Precheck and Report Errors: Checks for same-name tables in the destination before starting. The task fails the precheck if conflicts exist. To resolve conflicts, rename tables in the destination — see Object name mapping. Ignore Errors and Proceed: Skips the check. WarningThis may cause data inconsistency. During full migration, DTS keeps records already in the destination. During incremental migration, source records overwrite destination records with the same primary key.
Index name Table name: Uses the table name as the Elasticsearch index name. Database name_Table name: Creates an index name by concatenating the database name, an underscore ( _), and the table name. The chosen format applies to all migrated tables.Case Policy for Destination Object Names Set the case sensitivity policy for object names in the destination. The default is DTS default policy. See Case sensitivity policy for destination database object names. In the Source Objects box, click the objects to migrate, then click the right arrow to move them to the Selected Objects box.
Select individual tables rather than entire databases. Database-level selection does not capture future table additions or deletions.
In the Selected Objects box, optionally:
Right-click an object to rename it. See Individual table column mapping.
Click Batch Edit to rename multiple objects at once. See Map multiple object names at a time.
Right-click an object to set a WHERE clause filter. See Set filter conditions.
Right-click an object to select specific SQL operations to migrate at the database or table level.
Only underscores (
_) are allowed as special characters in index and type names. Using object name mapping may cause migration failures for dependent objects.
Step 4: Configure advanced settings
Click Next: Advanced Settings and configure the following parameters:
| Parameter | Description |
|---|---|
| Dedicated Cluster for Task Scheduling | By default, DTS schedules tasks on a shared cluster. To run tasks on a dedicated cluster for better stability, purchase a dedicated cluster first. |
| Retry Time for Failed Connections | How long DTS retries after a connection failure. Default: 720 minutes. Range: 10–1440 minutes. Set to more than 30 minutes. The task auto-resumes if reconnected within this period; otherwise it fails. Note For multiple DTS instances sharing the same source or destination, the retry time is determined by the most recently created task. Charges accrue during retry — set a value that matches your business tolerance. |
| Retry Time for Other Issues | How long DTS retries after non-connectivity issues (such as DDL or DML execution errors). Default: 10 minutes. Range: 1–1440 minutes. Set to more than 10 minutes. Must be less than Retry Time for Failed Connections. |
| Enable Throttling for Full Data Migration | Limits DTS read/write rate to reduce load on source and destination during full migration. Set Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s). You can also adjust speed after the task starts. Available only when Full Data Migration is selected. |
| Enable Throttling for Incremental Data Migration | Limits DTS rate during incremental migration. Set RPS of Incremental Data Migration and Data migration speed for incremental migration (MB/s). You can also adjust speed after the task starts. Available only when Incremental Data Migration is selected. |
| Environment Tag | Assign an environment label to identify the instance (for example, production or staging). Optional. |
| Shard configuration | Set the number of primary shards and replica shards for the destination index, based on the maximum shard configuration of the index in the Elasticsearch instance. |
| String index | How DTS indexes string fields in Elasticsearch: analyzed — tokenize then index (also select an analyzer; see Analyzers). Use this for full-text search fields. not analyzed — index the raw value as-is. Use this for exact-match fields like IDs or tags. no — do not index the field. |
| Time zone | Time zone DTS uses when migrating DATETIME or TIMESTAMP data. If time-type data in the destination should not include time zones, pre-configure the document type in the destination instance. |
| DOCID | The column DTS uses as the Elasticsearch document ID (_id). Defaults to the table's primary key. If the table has no primary key, Elasticsearch generates an ID automatically. |
| Configure ETL | Select Yes to configure the ETL feature and enter data processing statements. Select No to skip ETL. |
| Monitoring and Alerting | Select Yes to configure an alert thresholdalert notifications and notification settings. DTS sends alerts if a migration fails or latency exceeds the threshold. |
Step 5: Configure routing and document ID
Click Next: Configure database and table fields and set the routing and document ID for each table:
| Parameter | Description |
|---|---|
| Configure _routing? | Yes: Route documents to specific shards using a custom column. No: Route using _id. Select No if the destination Elasticsearch instance is version 7.x. |
| _routing column | The column to use for routing. Required only when Configure _routing? is set to Yes. |
| _id value | The column to use as the document ID. |
Step 6: Save the task and run a 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.
Wait for the precheck to complete.
DTS runs a precheck before starting the migration. The task starts only after it passes the precheck. If the precheck fails, click View Details next to the failed item, fix the issue, and rerun the precheck. For warnings on items that can be ignored, click Confirm Alert Details > Ignore > OK > Precheck Again to proceed. Ignoring warnings may cause data inconsistency.
Step 7: Purchase the migration instance
After the Success Rate reaches 100%, click Next: Purchase Instance.
On the Purchase page, select the instance class:
Parameter Description Resource Group Settings Select the resource group. The default is the default resource group. See What is Resource Management? Instance Class The link specification determines migration speed. Select a class based on your data volume and performance requirements. See Data migration link specifications. Read and accept the Data Transmission Service (Pay-as-you-go) Service Terms.
Click Buy and Start, then click OK in the confirmation dialog.
Monitor migration progress
After the task starts, view its progress on the Data Migration Tasks list page.
Full migration only: The task stops automatically after full migration completes. The Status changes to Completed.
Full migration + incremental migration: The task continues running. The Status shows Running. Incremental migration keeps running until you manually stop the task.
Before switching production traffic to the destination, end or release the task to prevent automatic recovery from overwriting destination data.