All Products
Search
Document Center

Data Transmission Service:Precautions and limits for migrating data from a Redis database

Last Updated:Mar 18, 2024

This topic describes the precautions and limits when you use Data Transmission Service (DTS) to migrate data from a Redis database, such as a self-managed Redis database or an ApsaraDB for Redis database. To ensure that your data migration task runs as expected, read the precautions and limits before you configure the task.

Scenarios of migrating data from a Redis database

For more information about the precautions and limits in different scenarios of migrating data between Redis databases, see the Migrate data between Redis databases section of this topic.

Migrate data between Redis databases

Category

Description

Limits on the source database

  • Bandwidth requirements: The server on which the source database is deployed must have sufficient outbound bandwidth. Otherwise, the data migration speed decreases.

  • You must enable the data logging and append-only file (AOF) logging features for the source database.

  • The database version of the source ApsaraDB for Redis instance cannot be 2.8.

  • Limits on operations: If you perform only full data migration, do not write data to the source database during data migration. Otherwise, data may be inconsistent between the source and destination databases. To ensure data consistency, we recommend that you select full data migration and incremental data migration as the migration types.

  • Limits on data migration from a standalone Redis database to a Redis database deployed in the cluster architecture: Each command can be run only on a single slot in a Redis database deployed in the cluster architecture. If you perform operations on multiple keys in the source database and the keys belong to different slots, the following error occurs:

    CROSSSLOT Keys in request don't hash to the same slot

    We recommend that you perform operations on only one key during data migration. Otherwise, the migration task is interrupted.

  • To ensure the stability of data migration, DTS inserts a key prefixed with DTS_REDIS_TIMESTAMP_HEARTBEAT into the source database to record when data is updated. If the source database is deployed in a cluster architecture, DTS inserts the key into each shard of the cluster. The key is filtered out during data migration. After the data migration task is complete, the key expires.

  • If the source database is a read-only database or the source database account that is used to run the data migration task does not have the permissions to run the SETEX command, the reported latency may be inaccurate.

Other limits

  • A storage-optimized instance of ApsaraDB for Redis Enhanced Edition (Tair) cannot be configured as the source or destination database.

  • If data eviction is triggered due to insufficient memory of the destination database, data inconsistency may occur between the source and destination databases. This is because the default data eviction policy (maxmemory-policy) of the destination database is volatile-lru. However, this does not affect the migration task.

    In this case, we recommend that you set the data eviction policy of the destination database to noeviction. If the memory of the destination database is insufficient, DTS fails to write data to the destination database and the migration task fails, but data of the destination database is not lost due to data eviction.

    Note

    For more information about data eviction policies, see How does ApsaraDB for Redis evict data by default?

  • If you call Lua scripts by running the EVAL or EVALSHA command, DTS cannot identify whether these Lua scripts are executed on the destination database. This is because the destination database does not explicitly return the execution results of Lua scripts during incremental data migration.

  • When DTS runs the PSYNC or SYNC command to transfer data of the LIST type, DTS does not perform the FLUSH operation on the existing data in the destination instance. As a result, the destination instance may contain duplicate data records.

  • If an expiration policy is enabled for specific keys in the source database, these keys may not be immediately deleted after they expire. Therefore, the number of keys in the destination instance may be less than that in the source database. You can run the INFO command to view the number of keys in the destination database.

    Note

    The number of keys that do not have the expiration policy enabled or have not expired is the same in the source and destination databases.

  • To ensure compatibility, the version of the destination Redis database must be the same as or later than that of the source Redis database.

    Note

    If the version of the destination database is earlier than that of the source database, database compatibility issues may occur.

  • Before you migrate data, evaluate the impact of data migration on the performance of the source and destination databases. We recommend that you migrate data during off-peak hours. During full data migration, DTS uses read and write resources of the source and destination databases. This may increase the loads of the database servers.

  • During full data migration, concurrent INSERT operations cause fragmentation in the tables of the destination database. After full data migration is complete, the size of used tablespace of the destination database is larger than that of the source database.

  • DTS attempts to resume the data migration task that failed within the last seven days. Before you switch workloads to the destination database, you must stop or release the failed tasks. You can also execute the REVOKE statement to revoke the write permissions from the accounts that are used by DTS to access the destination database. Otherwise, the data in the source database overwrites the data in the destination instance after the task is resumed.

  • If both the source and destination databases are of ApsaraDB for Redis Community Edition or Enhanced Edition, take note of the following limits: If the database configurations are changed, such as the specifications or port number, DTS cannot obtain continuous log data or correct connection information. As a result, the data migration task is interrupted. To ensure data consistency, we recommend that you delete the data in the destination database and reconfigure the data migration task after the database configurations are changed.

  • If the destination instance is deployed in a cluster architecture and the amount of memory used by a shard in the destination instance reaches the upper limit, or if the available storage space of the destination instance is insufficient, the data synchronization task fails due to out of memory (OOM).

  • If the Transparent Data Encryption (TDE) feature is enabled for the destination database, you cannot use DTS to migrate data.

  • If resumable upload fails during data migration due to transient connections that occur on the source Redis database, full data may be migrated to the destination database again. This may cause data inconsistency between the source and destination databases.

Special cases

If the source database is a self-managed Redis database, take note of the following limits:

  • If you perform a primary/secondary switchover on the source database when the data migration task is running, the data migration task fails.

  • DTS calculates migration latency based on the timestamp of the latest migrated data in the destination database and the current timestamp in the source database. If no DML operation is performed on the source database for an extended period of time, the migration latency may be inaccurate. If the latency of the data migration task is excessively high, you can perform a DML operation on the source database to update the latency.

    Note

    If you select an entire database as the object to be migrated, you can create a heartbeat table. The heartbeat table is updated or receives data every second.

  • If resumable upload fails during data migration due to transient connections that occur on the source Redis database, full data may be migrated to the destination database again. This may cause data inconsistency between the source and destination databases.