If you want to migrate data from one ApsaraDB for Redis instance to another ApsaraDB for Redis instance, you can consider one of the following methods: use backup sets to clone data to the new instance, use the data flashback feature to clone data to the new instance, or use Data Transmission Service (DTS) to implement one-way data migration between a self-managed Redis database and the ApsaraDB for Redis instance. DTS supports full and incremental data migration. When you configure a data migration task, you can select both types to ensure service continuity. This topic compares the three data migration methods and details how to use DTS to migrate Redis data.
Comparison of methods for data migration between ApsaraDB for Redis instances
Prerequisites
- The source and destination ApsaraDB for Redis instances are created. Note
- For more information about how to create an ApsaraDB for Redis instance, see Step 1: Create an ApsaraDB for Redis instance.
- For more information about the supported database engine versions, see Overview of data migration scenarios.
- The available storage space of the destination ApsaraDB for Redis instance is larger than the total size of the data in the source ApsaraDB for Redis instance.
Limits
Category | Migration description |
Limits on the source database |
|
Other limits |
|
Special cases | If the source database is a self-managed Redis database, take note of the following limits:
|
Migration types
Migration type | Description |
Full data migration | DTS migrates the existing data of objects from the source database to the destination database. |
Incremental data migration | After full data migration is complete, DTS migrates incremental data from the source database to the destination database. Incremental data migration allows data to be migrated smoothly without interrupting the services of self-managed applications during data migration. |
Commands that are supported by incremental data migration
- APPEND
- BITOP, BLPOP, BRPOP, and BRPOPLPUSH
- DECR, DECRBY, and DEL
- EVAL, EVALSHA, EXEC, EXPIRE, and EXPIREAT
- FLUSHALL and FLUSHDB
- 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
Procedure
- Go to the Data Migration Tasks page.
- Log on to the Data Management (DMS) console.
- In the top navigation bar, click DTS.
- In the left-side navigation pane, choose .
Note- Operations may vary based on the mode and layout of the DMS console. For more information, see Simple mode and Customize the layout and style of the DMS console.
- You can also go to the Data Migration Tasks page of the new DTS console.
- From the drop-down list next to Data Migration Tasks, select the region in which the data migration instance resides. Note If you use the new DTS console, you must select the region in which the data migration instance resides in the upper-left corner.
- Click Create Task. In the Create Task wizard, configure the source and destination databases.
Section Parameter Description N/A Task Name The name of the task. DTS automatically assigns a name to the task. We recommend that you specify a descriptive name that makes it easy to identify the task. You do not need to specify a unique task name.
Source Database Select an existing DMS database instance The database instance that you want to use. You can determine whether to select an existing instance based on your business requirements.
If you select an existing instance, DTS automatically populates the parameters for the instance.
If you do not select an existing instance, you must configure parameters for the source database.
Database Type Select Tair/Redis. Access Method Select Alibaba Cloud Instance. In this example, the source and destination databases are ApsaraDB for Redis instances. You can also follow the procedure to configure data migration tasks for other types of databases. Instance Region The region where the source ApsaraDB for Redis instance resides. Replicate Data Across Alibaba Cloud Accounts Specifies whether data is replicated across Alibaba Cloud accounts. In this example, No is selected. Instance ID The ID of the source ApsaraDB for Redis instance. Database Password The database password of the source ApsaraDB for Redis instance. The database account that corresponds to the password must have the read permissions. If you forget the password, you can reset the password. For more information, see Change or reset the password. - If you use the default account whose username is the same as the instance ID, you can enter only the password.
- If you create a custom account, you must specify the password in the
<Custom account>:<Password>
format. Example: testaccount:Test1234.
Note This parameter is optional and can be left empty if no database password is set.Destination Database Select an existing DMS database instance The database instance that you want to use. You can determine whether to select an existing instance based on your business requirements.
If you select an existing instance, DTS automatically populates the parameters for the instance.
If you do not select an existing instance, you must configure parameters for the destination database.
Database Type Select Tair/Redis. Access Method Select Alibaba Cloud Instance. Instance Region The region where the destination ApsaraDB for Redis instance resides. Instance ID The ID of the destination ApsaraDB for Redis instance. Database Password The database password of the destination ApsaraDB for Redis instance. The database account that corresponds to the password must have the read permissions. If you forget the password, you can reset the password. For more information, see Change or reset the password. - If you use the default account whose username is the same as the instance ID, you can enter only the password.
- If you create a custom account, you must specify the password in the
<Custom account>:<Password>
format. Example: testaccount:Test1234.
- In the lower part of the page, click Test Connectivity and Proceed.Warning
If the public CIDR blocks of DTS servers are automatically or manually added to the IP address whitelist of a database instance or to the security group rules of an ECS instance, security risks may arise. Therefore, before you use DTS to migrate data, you must understand and acknowledge the potential risks and take preventive measures, including but not limited to the following measures: enhancing the security of your account and password, limiting the ports that are exposed, authenticating API calls, regularly checking the IP address whitelist or ECS security group rules and forbidding unauthorized CIDR blocks, and connecting the database to DTS by using Express Connect, VPN Gateway, or Smart Access Gateway.
- Configure the objects to be migrated and advanced settings.
- Basic Settings
Parameter Description Migration Types Select Full Data Migration and Incremental Data Migration. For more information, see Migration types.
Processing Mode of Conflicting Tables Source Objects Select one or more objects from the Source Objects section and click the icon to add the objects to the Selected Objects section.
Note You can select databases as the objects to be migrated. Keys cannot be selected as objects to be migrated.Selected Objects - The objects that you select to be migrated. In this scenario, you cannot rename the objects.
- In the Selected Objects section, right-click an object. In the dialog box that appears, select the commands that you want to migrate. For more information, see Commands that are supported by incremental data migration.
- Advanced Settings
Parameter Description Set Alerts Specifies whether to configure alerting for the data migration task. If the task fails or the migration latency exceeds the specified threshold, the alert contacts will receive notifications. Valid values:
No: does not configure alerting.
Yes: configures alerting. If you select Yes, you must also specify the alert threshold and alert contacts. For more information, see Configure monitoring and alerting.
Retry Time for Failed Connections The retry time range for failed connections. If the data migration task fails, DTS immediately retries a connection within the time range. Valid values: 10 to 1440. Unit: minutes. Default value: 120. We recommend that you set the parameter to a value greater than 30. If DTS reconnects to the source and destination databases within the specified time range, DTS resumes the data migration task. Otherwise, the data migration task fails.Note- If an instance serves as the source database of multiple data migration tasks, the less value of this parameter that is set for the instance takes precedence.
- When DTS retries a connection, you are charged for the DTS instance. We recommend that you specify the retry time range based on your business requirements. You can also release the DTS instance at your earliest opportunity after the source and destination instances are released.
Extend Expiration Time of Destination Database Key The extended time period for keys migrated from the source database to the destination instance to remain valid. Unit: seconds. If specific commands are used, such as the following commands, we recommend that you set the parameter to 600 to ensure data consistency:expire key seconds pexpire key milliseconds expireat key timestamp pexpireat key timestampMs
Configure ETL Specifies whether to configure the extract, transform, and load (ETL) feature. For more information, see What is ETL?. Valid values:- Yes: configures the ETL feature. You can enter data processing statements in the code editor. For more information, see Configure ETL in a data migration or synchronization task.
- No: does not configure the ETL feature.
- Basic Settings
In the lower part of the page, click Next: Save Task Settings and Precheck.
You can move the pointer over Next: Save Task Settings and Precheck and click Preview OpenAPI parameters to view the parameters to be specified when you call the relevant API operation to configure the DTS task.
NoteBefore you can start the data migration task, DTS performs a precheck. You can start the data migration task only after the task passes the precheck.
If the task fails to pass the precheck, click View Details next to each failed item. After you troubleshoot the issues based on the error message, you can run a precheck again.
If an alert is triggered for an item during the precheck:
If the alert item cannot be ignored, click View Details next to the failed item and troubleshoot the issues. Then, run a precheck again.
If the alert item can be ignored, click Confirm Alert Details. In the View Details dialog box, click Ignore. In the message that appears, click OK. Then, click Precheck Again to run a precheck again. If you ignore the alert item, data inconsistency may occur and your business may be exposed to potential risks.
Wait until the success rate becomes 100%. Then, click Next: Purchase Instance.
On the Purchase Instance page, configure the Instance Class parameter for the data migration instance. The following table describes the parameters.
Section
Parameter
Description
New Instance Class
Resource Group
The resource group to which the data migration instance belongs. Default value: default resource group. For more information, see What is Resource Management?
Instance Class
DTS provides instance classes that vary in the migration speed. You can select an instance class based on your business scenario. For more information, see Specifications of data migration instances.
Read and agree to Data Transmission Service (Pay-as-you-go) Service Terms by selecting the check box.
Click Buy and Start to start the data migration task. You can view the progress of the task in the task list.
References
If you want to clone the full data of an ApsaraDB for Redis instance to a new ApsaraDB for Redis instance, you can use the backup and restoration feature. For information about the differences between cloning data to a new instance by using backup and restoration and migrating data by using DTS, see Comparison of methods for data migration between ApsaraDB for Redis instances.
For more information, see Restore data from a backup set to a new instance and Use data flashback to restore data by point in time.