When you need to migrate or merge Redis data across Alibaba Cloud accounts — for example, after a business restructuring or account consolidation — you can use Data Transmission Service (DTS) to set up one-way data synchronization between two Tair (Redis OSS-Compatible) instances owned by different accounts.
Overview
The setup involves two accounts acting in sequence:
| Step | Account | Action |
|---|---|---|
| 1. Grant cross-account access | Account A (source owner) | Create a RAM role and set Account B as the trusted account, authorizing DTS to read Account A's resources. |
| 2. Configure the sync task | Account B (destination owner) | Log in to the DTS console and create the data synchronization task, referencing the RAM role from Step 1. |
Prerequisites
Before you begin, make sure you have:
A destination Tair (Redis OSS-Compatible) instance that is already created
Sufficient storage space in the destination instance — available space must exceed the total data size of the source instance
Compatible instance versions — synchronize from an older version to a newer version, or between instances of the same version
For supported instance versions, see Overview of data synchronization solutions.
Billing
| Synchronization type | Fee |
|---|---|
| Schema synchronization and full data synchronization | Free |
| Incremental data synchronization | Charged. For details, see Billing overview. |
Limitations
Before you start
Review these constraints before configuring the task:
Version compatibility: Synchronize from an older version to a newer version only. Synchronizing from a newer version to an older version may cause compatibility issues.
Cluster source — single-key commands only: If the source uses a cluster architecture, run only single-key commands during synchronization. Commands that operate on keys across different slots cause a
CROSSSLOT Keys in request don't hash to the same sloterror and break the sync link.Tair Enterprise Edition with Persistent Memory: If the source instance is a Tair Enterprise Edition instance using Persistent Memory as the storage medium, set the
appendonlyparameter toyesbefore starting. See Procedure.Transport Layer Security (TLS): If TLS is enabled on the source or destination instance, use an SSL-encrypted connection in DTS. TLSv1.3 is not supported. A TLS-enabled Tair instance cannot be connected as an Alibaba Cloud Instance type in DTS.
Transparent Data Encryption (TDE): If TDE is enabled on either instance, DTS cannot be used for synchronization.
Replication backlog size: To ensure a stable synchronization link, increase the value of the
repl-backlog-sizeparameter in theredis.conffile.Self-managed Redis source — replication timeout: Run
config set repl-timeout 600to set the replication timeout to 600 seconds. Increase the value further if the source contains large amounts of data.
During synchronization
Keep these constraints in mind while the task is running:
Do not write from other sources to the destination. Writing data from other sources to the destination causes data inconsistency between the source and destination.
Destination memory policy: By default, Tair (Redis OSS-Compatible) instances use
volatile-lrufor data eviction. If the destination runs low on memory, data may be silently evicted without stopping the task, causing inconsistency. To prevent silent data loss, setmaxmemory-policytonoevictionon the destination — if memory runs out, the task fails rather than evicting data. For details, see What is the default eviction policy?Destination cluster out of memory (OOM): If a shard in the destination cluster reaches its memory limit, or if the destination has insufficient storage, the sync task fails due to OOM.
Expiration keys: Expired keys in the source may not be immediately deleted in the destination. The destination key count may be smaller than the source key count. Run the
infocommand to verify key counts.DTS heartbeat key: DTS inserts a key prefixed with
DTS_REDIS_TIMESTAMP_HEARTBEATinto the source database to track update timestamps. If the source database uses a cluster architecture, DTS inserts this key into each shard. This key is filtered during synchronization and expires when the task ends.Latency reporting: If the source is a read-only instance or the DTS account lacks SETEX permission, the reported latency may be inaccurate.
Endpoint changes: If the source or destination endpoint changes during synchronization (for example, due to instance migration or failover), the task may retry, experience latency, fail, or cause data inconsistency. Check the task status promptly and reconfigure if needed.
Scaling the source: If the source is scaled (shards added or removed) or its memory is scaled up during synchronization, reconfigure the task. Clear the destination data before reconfiguring to maintain consistency.
Primary/replica failover on the destination: If a failover is triggered on the destination, data may be written only to memory and not persisted to the replica, which can cause data loss.
Full re-synchronization triggers: The following events may cause all data to be re-synchronized to the destination, resulting in temporary data inconsistency:
A transient connection failure prevents the task from resuming from a breakpoint
A primary/replica failover occurs on the source or destination instance
The endpoint of the source or destination instance changes
The synchronization objects of the DTS instance are modified
DTS instance failure recovery: If an instance fails, DTS helpdesk will try to recover the instance within 8 hours. Recovery may include restarting the DTS instance or adjusting its parameters (database parameters are not modified). For parameters that may be modified, see Modify instance parameters.
Full and incremental restart: If a DTS instance that runs both full and incremental synchronization tasks is restarted, both tasks restart from the beginning.
Supported commands for incremental synchronization
Tair (Redis OSS-Compatible) Open-Source Edition
APPEND, BITOP, BLPOP, BRPOP, BRPOPLPUSH, DECR, DECRBY, DEL, EVAL, EVALSHA, EXEC, EXPIRE, EXPIREAT, GEOADD, GETSET, HDEL, HINCRBY, HINCRBYFLOAT, HMSET, HSET, HSETNX, INCR, INCRBY, INCRBYFLOAT, LINSERT, LPOP, LPUSH, LPUSHX, LREM, LSET, LTRIM, MOVE, MSET, MSETNX, MULTI, PERSIST, PEXPIRE, PEXPIREAT, PFADD, PFMERGE, PSETEX, RENAME, RENAMENX, RESTORE, RPOP, RPOPLPUSH, RPUSH, RPUSHX, SADD, SDIFFSTORE, SELECT, SET, SETBIT, SETEX, SETNX, SETRANGE, SINTERSTORE, SMOVE, SPOP, SREM, SUNIONSTORE, SWAPDB\*, UNLINK\*, XADD, XAUTOCLAIM, XCLAIM, XDEL, XGROUP CREATECONSUMER, XTRIM, ZADD, ZINCRBY, ZINTERSTORE, ZREM, ZREMRANGEBYLEX, ZUNIONSTORE, ZREMRANGEBYRANK, ZREMRANGEBYSCORE
\* SWAPDB and UNLINK are supported only when the source engine version is Redis 4.0.
Tair (Redis OSS-Compatible) Enterprise Edition
APPEND, BITOP, BLPOP, BRPOP, BRPOPLPUSH, DECR, DECRBY, DEL, EVAL, EVALSHA, EXEC, EXPIRE, EXPIREAT, GEOADD, GETSET, HDEL, HINCRBY, HINCRBYFLOAT, HMSET, HSET, HSETNX, INCR, INCRBY, INCRBYFLOAT, LINSERT, LPOP, LPUSH, LPUSHX, LREM, LSET, LTRIM, MOVE, MSET, MSETNX, MULTI, PERSIST, PEXPIRE, PEXPIREAT, PFADD, PFMERGE, PSETEX, RENAME, RENAMENX, RPOP, RPOPLPUSH, RPUSH, RPUSHX, SADD, SDIFFSTORE, SELECT, SET, SETBIT, SETEX, SETNX, SETRANGE, SINTERSTORE, SMOVE, SPOP, SREM, SUNIONSTORE, UNLINK, XADD, XAUTOCLAIM, XCLAIM, XDEL, XGROUP CREATECONSUMER, XTRIM, ZADD, ZINCRBY, ZINTERSTORE, ZREM, ZREMRANGEBYLEX, ZUNIONSTORE, ZREMRANGEBYRANK, ZREMRANGEBYSCORE
Commands with special behavior
| Command | Behavior |
|---|---|
| PUBLISH | Cannot be synchronized. |
| EVAL, EVALSHA | DTS cannot confirm whether Lua scripts are executed on the destination — the destination does not return explicit execution results during incremental sync. |
| SYNC, PSYNC (LIST type) | DTS does not clear existing LIST data in the destination before syncing. The destination may contain duplicate records. |
Step 1: Grant cross-account access (Account A)
Log in to the Alibaba Cloud Management Console using the account that owns the source Tair instance (Account A). Create a RAM role and set the account that owns the destination instance (Account B) as the trusted account, authorizing the RAM role to access Account A's cloud resources.
This feature supports cross-site communication, allowing communication between Chinese mainland (China site) accounts and international site accounts.
For step-by-step instructions, see Configure RAM authorization for cross-account DTS tasks.
Step 2: Configure the sync task (Account B)
Log in using the account that owns the destination Tair instance (Account B) and complete the following steps.
Go to the Data Synchronization page
DTS console
Log in to the DTS console.DTS console
In the left navigation pane, click Data Synchronization.
In the upper-left corner, select the region where the sync task will reside.
DMS console
The exact navigation may vary based on your DMS console mode and layout. For details, see Simple mode and Customize the layout and style of the DMS console.
Log in to the DMS console.DMS console
In the top navigation bar, hover over Data + AI and choose DTS (DTS) > Data Synchronization.
From the drop-down list to the right of Data Synchronization Tasks, select the region where the sync instance resides.
Create and configure the task
Click Create Task.
(Optional) Click New Configuration Page in the upper-right corner.
Skip this step if the Back to Previous Version button is already displayed. The new and previous configuration pages may have different parameters — use the new version.
Configure the source and destination databases.
WarningAfter you configure the source and destination databases, read the Limits displayed on the page before proceeding. Skipping this may cause task failures or data inconsistency.
Source database
Parameter Value Task Name DTS auto-generates a name. Specify a descriptive name for easier identification. The name does not need to be unique. Select Existing Connection If the source instance is already registered with DTS, select it from the drop-down list — DTS populates the remaining fields automatically. Otherwise, configure the fields below. Database Type Select Tair/Redis. Access Method Select Alibaba Cloud Instance. Instance Region Select the region of the source Tair instance. Replicate Data Across Alibaba Cloud Accounts Select Yesalert notification settings. Alibaba Cloud Account Enter the ID of the Alibaba Cloud account (primary account) that owns the source instance. RAM Role Name Enter the name of the RAM role created in Step 1. Instance ID Select the source Tair instance ID. Authentication Method Select based on your requirements. This example uses Password Login. If you select Secret-free login, make sure that password-free access is enabled on the source instance. See Enable password-free access. Database Password Enter credentials with read permission. For custom accounts, use the format <account>:<password>(for example,testaccount:Test1234). For the default account (username matches the instance ID), enter the password directly. Leave blank if no password is set. To reset the password, see Modify or reset the password.Encryption Select Non-encrypted or SSL-encrypted. If you select SSL-encrypted for a self-managed Redis instance, upload a CA Certificate and enter a CA Key. Destination database
Parameter Value Select Existing Connection If the destination instance is already registered with DTS, select it from the drop-down list. Otherwise, configure the fields below. Database Type Select Tair/Redis. Access Method Select Alibaba Cloud Instance. Instance Region Select the region of the destination Tair instance. Replicate Data Across Alibaba Cloud Accounts Select No — the cross-account setting applies only to the source side. Instance ID Select the destination Tair instance ID. Authentication Method Select based on your requirements. This example uses Password Login. If you select Secret-free login, make sure that password-free access is enabled. See Enable password-free access. Database Password Enter credentials with read and write permissions. For custom accounts, use the format <account>:<password>. For the default account, enter the password directly. To reset, see Modify or reset the password.Encryption Select Non-encrypted or SSL-encrypted. Click Test Connectivity and Proceed.
DTS server CIDR blocks must be added to the security allowlist of the source and destination instances. This can be done automatically or manually. For details, see Add DTS server IP addresses to a whitelist. If either instance is self-managed (access method is not Alibaba Cloud Instance), click Test Connectivity in the CIDR Blocks of DTS Servers dialog box.
Configure the objects to synchronize. In the Configure Objects step, set the following parameters:
Parameter Description Synchronization Types By default, both Full Data Synchronization and Incremental Data Synchronization are selected. If you select Incremental Data Synchronization, also select Full Data Synchronization — the full sync runs first and provides the baseline for incremental sync. Synchronization Topology Select One-way Synchronization. This parameter is available only when both the source and destination are Tair (Enterprise Edition) instances. Processing Mode of Conflicting Tables Precheck and Report Errors: fails the precheck if data already exists in the destination. Ignore Errors and Proceed: skips the destination data existence check. WarningChoosing Ignore Errors and Proceed may cause data loss — source records overwrite destination records with the same keys.
Source Objects Select one or more databases from the Source Objects list and click the arrow icon to move them to Selected Objects. Only databases can be selected as sync objects — individual keys cannot. Selected Objects To map DB 0–255 or filter by key prefix, right-click a database in Selected Objects and choose Edit Schema. See Map object names and Specify filter conditions. Object names cannot be mapped in bulk. Click Next: Advanced Settings and configure the advanced parameters:
Parameter Description Dedicated Cluster for Task Scheduling By default, DTS schedules the task to a shared cluster. To improve stability, purchase a dedicated cluster. See What is a DTS dedicated cluster. Retry Time for Failed Connections How long DTS retries a failed connection before stopping the task. Valid values: 10–1,440 minutes. Default: 720. Set to a value greater than 30. If multiple tasks share the same source or destination, the shortest retry time applies. DTS charges you for the instance during retries — set this value based on your requirements and release the DTS instance promptly if the source or destination is released. Retry Time for Other Issues How long DTS retries failed DDL or DML operations. Valid values: 1–1,440 minutes. Default: 10. Set to a value greater than 10. This value must be less than Retry Time for Failed Connections. Enable Throttling for Full Data Synchronization Throttle read/write resource usage during full sync to reduce load on both instances. Configure Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s). Available only when Full Data Synchronization is selected. Enable Throttling for Incremental Data Synchronization Throttle resource usage during incremental sync. Configure RPS of Incremental Data Synchronization and Data synchronization speed for incremental synchronization (MB/s). Extend Expiration Time of Destination Database Key Extend the TTL of keys synced to the destination by a specified number of seconds. Configure this when using expiration-based commands such as EXPIRE, PEXPIRE, EXPIREAT, or PEXPIREAT. NoteIn a distributed lock scenario, an extended TTL may delay lock release.
Environment Tag A label to identify the DTS instance. Optional. Configure ETL Whether to enable extract, transform, and load (ETL) processing. Select Yes to configure ETL using the code editor. See Configure ETL in a data migration or data synchronization task. Select No to skip. For an overview, see What is ETL? Monitoring and Alerting Whether to configure alerts for the sync task. Select Yes to set alert thresholds and notification contacts — alerts are triggered on task failure or when latency exceeds the threshold. See Configure monitoring and alerting when you create a DTS task. Click Next Step: Data Verification to configure data verification (optional). See Configure a data verification task.
Save the task and run a precheck.
To preview the API parameters for this task configuration, hover over Next: Save Task Settings and Precheck and click Preview OpenAPI parameters.
Click Next: Save Task Settings and Precheck.
DTS runs a precheck before starting the task. The task starts only after the precheck passes. - If the precheck fails, click View Details next to each failed item, fix the issue, and rerun the precheck. - If the precheck generates an alert that can be ignored, click Confirm Alert Details, click Ignore in the dialog box, then click Precheck Again. Ignoring alerts may result in data inconsistency.
Purchase an instance.
Wait until the Success Rate reaches 100%, then click Next: Purchase Instance.
On the purchase page, configure the billing and instance settings:
Parameter Description Billing Method
Subscription: pay upfront; more cost-effective for long-term use. Pay-as-you-go: billed hourly; release the instance when no longer needed to avoid charges.
Resource Group Settings
The resource group for the sync instance. Default: default resource group. See What is Resource Management?
Instance Class
Select a class based on the required synchronization speed. See Instance classes of data synchronization instances.
Subscription Duration
Available only for the Subscription billing method. Options: 1–9 months, 1 year, 2 years, 3 years, or 5 years.
Read and accept Data Transmission Service (Pay-as-you-go) Service Terms.
Click Purchase and Start. In the confirmation dialog box, click OK. The task appears on the Data Synchronization page. If both full and incremental sync are configured, Incremental Data Synchronization is displayed as the current status after full sync completes.
What's next
After the sync task is running:
Monitor task status and latency on the Data Synchronization page.
Set up alerts to get notified when the task fails or latency exceeds a threshold. See Configure monitoring and alerting.
Verify data consistency between the source and destination using the data verification feature. See Configure a data verification task.