Data Transmission Service (DTS) allows you to perform one-way synchronization between ApsaraDB for Redis cluster instances under different Alibaba Cloud accounts. This feature is applicable to scenarios such as resource migration or resource merging across Alibaba Cloud accounts and business architecture adjustment.

Prerequisites

  • If the ApsaraDB for Redis cluster instance is a Community Edition instance, the engine version is Redis 4.0 or 5.0. If the ApsaraDB for Redis cluster instance is an Enhanced Edition instance, the engine version is Redis 5.0.
    Note The engine version of the destination instance can be Redis 4.0 or 5.0. The engine version of the destination instance must be no earlier than the engine version of the source instance. Before you synchronize data between two ApsaraDB for Redis cluster instances that use different engine versions, check the compatibility of the two versions. For example, you can create a destination ApsaraDB for Redis cluster instance of the pay-as-you-go billing method to verify the compatibility between the source and destination instances. Then, you can release this instance or change the billing method of the instance to subscription.
  • The source instance is deployed in a virtual private cloud (VPC). If the source instance is deployed in the classic network, you can change the network type to VPC. For more information, see Switch to VPC network.
  • Secure Sockets Layer (SSL) encryption is disabled for the source instance. For more information, see Configure SSL encryption.
  • The available storage space of the destination instance is larger than the used storage space of the source instance.
  • ApsaraDB for Redis Enhanced Edition is integrated with more Redis modules than ApsaraDB for Redis Community Edition. For more information, see Integration of multiple Redis modules. To ensure compatibility between the source and destination instances, the edition of the destination instance must be Enhanced if the edition of the source instance is Enhanced.

Background information

Two ApsaraDB for Redis cluster instances are created under different Alibaba Cloud accounts. Assume that you need to migrate data from the instance of account A to the instance of account B. The following figure shows the architecture of the migration solution.Data migration between ApsaraDB for Redis cluster instances under different accounts

DTS provides the following data migration solution:

DTS does not allow you to migrate data of an ApsaraDB for Redis cluster instance. In this solution, the data synchronization feature of DTS is used to synchronize data to the destination instance. The following table describes how to configure a data synchronization task.

Step Description
1. Use account A to log on to the Alibaba Cloud Management Console and grant the required permission to a RAM role. For more information, see step 1 in Before you begin. When you configure the RAM role, set account B as the trusted account, and authorize the RAM role to access the resources of account A.
2. Use account A to log on to the Alibaba Cloud Management Console and prepare the source instance. For more information, see steps 2 to 4 in Before you begin. Add the Classless Inter-Domain Routing (CIDR) blocks of the DTS server to the whitelist of the source ApsaraDB for Redis cluster instance. Apply for a private endpoint for the source instance, and create a database account that is authorized to replicate data of the source instance.
Note You are not allowed to create a database account that is authorized to replicate data of ApsaraDB for Redis cluster instances. To enable this feature, submit a ticket.
3. Use account B to log on to the Alibaba Cloud Management Console and configure the data synchronization task. For more information, see Procedure. DTS cannot read data from an ApsaraDB for Redis cluster instance under a different Alibaba Cloud account. When you configure the data synchronization task, you must configure the source instance as a user-created database that is connected to DTS over Express Connect.

Notes

  • DTS uses the resources of the source and destination instances during initial full data synchronization. This may increase the loads of the database servers. If you synchronize a large volume of data or the server specifications cannot meet your requirements, the database services may become unavailable. Before you synchronize data, evaluate the impact of data synchronization on the performance of the source and destination instances. We recommend that you synchronize data during off-peak hours.
  • We recommend that you do not run the FLUSHDB or FLUSHALL command on the source instance during data synchronization. If you run one of the two commands, data in the source and destination instances may be inconsistent.
  • If the data eviction policy (maxmemory-policy) of the destination instance is not set to noeviction, data may become inconsistent between the source and destination instances. For more information about the data eviction policy, see How does ApsaraDB for Redis evict data by default?

Commands that can be synchronized

Edition Command
ApsaraDB for Redis Community Edition
  • APPEND
  • BITOP, BLPOP, BRPOP, and BRPOPLPUSH
  • DECR, DECRBY, and DEL
  • EVAL, EVALSHA, EXEC, EXPIRE, and EXPIREAT
  • GEOADD and GETSET
  • HDEL, HINCRBY, HINCRBYFLOAT, HMSET, HSET, and HSETNX
  • INCR, INCRBY, and INCRBYFLOAT
  • LINSERT, LPOP, LPUSH, LPUSHX, LREM, LSET, and LTRIM
  • MOVE, MSET, MSETNX, and MULTI
  • PERSIST, PEXPIRE, PEXPIREAT, PFADD, PFMERGE, PSETEX, and PUBLISH
  • RENAME, RENAMENX, RESTORE, RPOP, RPOPLPUSH, RPUSH, and RPUSHX
  • SADD, SDIFFSTORE, SELECT, SET, SETBIT, SETEX, SETNX, SETRANGE, SINTERSTORE, SMOVE, SPOP, SREM, and SUNIONSTORE
  • ZADD, ZINCRBY, ZINTERSTORE, ZREM, ZREMRANGEBYLEX, ZUNIONSTORE, ZREMRANGEBYRANK, and ZREMRANGEBYSCORE
  • SWAPDB and UNLINK. These commands can be synchronized only if the engine version of the source instance is Redis 4.0.
ApsaraDB for Redis Enhanced Edition (Tair)
  • APPEND
  • BITOP, BLPOP, BRPOP, and BRPOPLPUSH
  • DECR, DECRBY, and DEL
  • EVAL, EVALSHA, EXEC, EXPIRE, and EXPIREAT
  • GEOADD and GETSET
  • HDEL, HINCRBY, HINCRBYFLOAT, HMSET, HSET, and HSETNX
  • INCR, INCRBY, and INCRBYFLOAT
  • LINSERT, LPOP, LPUSH, LPUSHX, LREM, LSET, and LTRIM
  • MOVE, MSET, MSETNX, and MULTI
  • PERSIST, PEXPIRE, PEXPIREAT, PFADD, PFMERGE, PSETEX, and PUBLISH
  • RENAME, RENAMENX, RPOP, RPOPLPUSH, RPUSH, and RPUSHX
  • SADD, SDIFFSTORE, SELECT, SET, SETBIT, SETEX, SETNX, SETRANGE, SINTERSTORE, SMOVE, SPOP, SREM, and SUNIONSTORE
  • UNLINK, ZADD, ZINCRBY, ZINTERSTORE, ZREM, ZREMRANGEBYLEX, ZUNIONSTORE, ZREMRANGEBYRANK, and ZREMRANGEBYSCORE
Note
  • If you run the EVAL or EVALSHA command to call Lua scripts, DTS cannot identify whether these Lua scripts are executed on the destination database. During incremental data synchronization, the destination database does not explicitly return the execution results of Lua scripts.
  • When DTS calls the SYNC or PSYNC command to transfer data of the LIST type, DTS does not clear the existing data. In this case, the destination database may contain duplicate data records.

Before you begin

Use the Alibaba Cloud account that owns the source instance to log on to the Alibaba Cloud Management Console. Then, perform the following steps:

  1. Create a RAM role and authorize the RAM role to access the resources of the Alibaba Cloud account. For more information, see Configure RAM authorization for data migration from a user-created database in a VPC across different Alibaba Cloud accounts.
  2. Apply for a private endpoint for the source instance. For more information, see Enable a direct connection.
  3. Select the CIDR blocks of the DTS server that is deployed in the region of the source ApsaraDB for Redis cluster instance. Add these CIDR blocks to the whitelist of the source instance. For more information, see Step 2: Set IP address whitelists.
    Note For more information about the CIDR blocks of the DTS servers in each region, see Add the CIDR blocks of DTS servers to the security settings of on-premises databases.
  4. Create a database account that can be used for data synchronization for the source instance.
    1. To create a database account that is authorized to replicate data of an ApsaraDB for Redis cluster instance, submit a ticket.
      Note You are not allowed to create a database account that is authorized to replicate data of ApsaraDB for Redis cluster instances. To enable this feature, submit a ticket.
    2. Create a database account that is authorized to replicate data of the source instance. For more information, see Manage database accounts.

Procedure

  1. Use the Alibaba Cloud account that owns the destination ApsaraDB for Redis cluster instance to log on to the Alibaba Cloud Management Console. Then, purchase a license for the data synchronization task. For more information, see Purchase procedure.
    Note Follow these rules to set the parameters:
    • Set Source Instance to Redis, Target Instance to Redis, and Synchronization Topology to One-Way Synchronization.
    • Set the regions of the source and destination instances to the regions that you specified when you purchased the license for the data synchronization task.
  2. Log on to the DTS console.
  3. In the left-side navigation pane, click Data Synchronization.
  4. At the top of the Synchronization Tasks page, select the region where the destination instance resides.
    Select a region
  5. Select User-Created Database Connected over Express Connect, VPN Gateway, or Smart Access Gateway as the instance type. Then, click VPC of Another Alibaba Cloud Account next to the Peer VPC field.
    Note DTS cannot read data from an ApsaraDB for Redis cluster instance under a different Alibaba Cloud account. When you configure the data synchronization task, you must configure the source instance as a user-created database that is connected to DTS over Express Connect.
  6. Configure the source and destination instances for data synchronization.
    1. Optional:Specify a task name that indicates the task purpose. You do not need to specify a unique task name.
    2. Select User-Created Database Connected over Express Connect, VPN Gateway, or Smart Access Gateway as the instance type. Then, click VPC of Another Alibaba Cloud Account next to the Peer VPC field.
      Select a VPC under another Alibaba Cloud account
    3. Configure the source instance.
      Configure the source instance
      Parameter Description
      Instance Type Select User-Created Database Connected over Express Connect, VPN Gateway, or Smart Access Gateway.
      Instance Region Set this parameter to the region that you selected for the source instance when you purchased the license for the data synchronization task. You cannot change the value of this parameter.
      Alibaba Cloud Account ID Enter the ID of the Alibaba Cloud account that owns the source instance.
      Note To obtain the ID of an account, use this account to log on to the Alibaba Cloud Management Console, and click the user profile icon in the upper-right corner. On the Account Management page, click Security Settings to view the account ID.
      Alibaba Cloud account ID
      Role Name Enter the name of the RAM role that you created in step 1 of Before you begin.
      Peer VPC Select the VPC where the source instance is deployed.
      Database Type Select Redis.
      Instance Mode Select Cluster.
      IP Address Enter the IP address that corresponds to the private endpoint that you obtained for the source instance in step 2 of Before you begin. In this example, enter 192.168.0.153.
      Note Run the ping command on your machine to obtain the IP address. For example, run the ping r-********.redis.rds.aliyuncs.com command.
      Port Number Enter the service port number of the source instance.
      Database Password Enter the password of the account you created in step 4 of Before you begin. This account is authorized to replicate data from the source instance.
      Note The format of the database password is <user>:<password>. For example, if the username of the custom account is admin and the password is Rp829dlwa, the database password is admin:Rp829dlwa.
    4. Configure the destination instance.
      Configure the destination instance
      Parameter Description
      Instance Type Select Redis Instance.
      Instance Region Set this parameter to the region that you selected for the destination instance when you purchased the license for the data synchronization task. You cannot change the value of this parameter.
      Redis Instance ID Select the ID of the destination instance.
      Database Password Enter the password of the destination database. The database account must have the read and write permissions on the destination instance.
      Note The format of the database password is <user>:<password>. For example, if the username of the custom account is admin and the password is Rp829dlwa, the database password is admin:Rp829dlwa.
  7. In the lower-right corner of the page, click Set Whitelist and Next.
    Note The CIDR blocks of the DTS server are automatically added to the whitelist of the destination ApsaraDB for Redis cluster instance. This ensures that the DTS servers can connect to the source and destination ApsaraDB for Redis cluster instances.
  8. Specify the processing mode in the scenario where a table to be synchronized already exists in the destination instance. Select the objects to be synchronized.
    Select objects to be synchronized
    Parameter Description
    Processing Mode In Existed Target Table
    • Pre-check and Intercept: checks whether the destination database is empty. If the destination database is empty, the precheck is passed. If the database is not empty, an error is returned during the precheck and the data synchronization task cannot be started.
    • Ignore: skips the check for empty destination databases.
      Warning If you select Ignore, the data records in the source database overwrite the data records that have the same keys in the destination database.
    Objects
    • Select one or more databases from the Available section and click the icon to move the databases to the Selected section.
    • You can select only databases as the objects to be synchronized. You cannot select keys as the objects to be synchronized.
  9. In the lower-right corner of the page, click Next.
  10. Configure initial synchronization.
    Configure initial synchronization
    Note The value is set to Include full data + incremental data. DTS synchronizes existing data of the source ApsaraDB for Redis cluster instance to the destination ApsaraDB for Redis cluster instance and then synchronizes incremental data.
  11. In the lower-right corner of the page, click Precheck.
    Note
    • Before you can start the data synchronization task, a precheck is performed. You can start the data synchronization task only after the task passes the precheck.
    • If the task fails to pass the precheck, click the Info icon icon next to each failed item to view details. Troubleshoot the issues based on the causes and run the precheck again.
  12. Close the Precheck dialog box after the following message is displayed: The precheck is passed.
  13. Wait until initial synchronization is complete and the data synchronization task enters the Synchronizing state.
    Status of the data synchronization task
    Note You can view the status of the data synchronization task on the Synchronization Tasks page.