This topic describes how to use Data Transmission Service (DTS) to migrate data from a self-managed Redis database to a Tair (Redis OSS-Compatible) instance. DTS supports both full and incremental data migration. Combining these migration types allows you to smoothly migrate your self-managed Redis database to the cloud with minimal service interruption.
Prerequisites
-
You have created a source self-managed Redis instance and a destination Tair (Redis OSS-Compatible) instance. For more information about how to create a Tair (Redis OSS-Compatible) instance, see Step 1: Create an instance.
Note-
DTS currently supports only Tair (Redis OSS-Compatible) instances that use the direct connection mode.
-
For information about the supported versions of the source and destination databases, see Migration solutions overview.
-
-
The self-managed Redis can properly run the
psyncorsynccommands. -
The destination Tair (Redis OSS-Compatible) instance must have more available storage space than the amount used by the source self-managed Redis database.
Usage notes
Type | Description |
Source database limits |
|
Other limits |
|
Billing
|
Migration type |
Instance configuration fee |
Internet traffic fee |
|
Full data migration |
Free of charge. |
When the Access Method parameter of the destination database is set to Public IP Address, you are charged for Internet traffic. For more information, see Billing overview. |
|
Incremental data migration |
Charged. For more information, see Billing overview. |
Migration types
-
Full data migration
DTS migrates all existing data of the selected objects from the self-managed Redis database to the destination Tair (Redis OSS-Compatible) instance.
NoteIf you perform only a full data migration, do not write new data to the self-managed Redis database during the migration to ensure data consistency.
-
Incremental data migration
In addition to the full data migration, DTS migrates incremental data updates from the self-managed Redis database to the destination Tair (Redis OSS-Compatible) instance. Incremental data migration allows for a smooth migration to the cloud without service interruptions.
Commands supported for incremental data migration
APPEND
BITOP, BLPOP, BRPOP, BRPOPLPUSH
DECR, DECRBY, DEL
EVAL, EVALSHA, EXEC, EXPIRE, EXPIREAT
FLUSHALL, FLUSHDB
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, PUBLISH
RENAME, RENAMENX, RESTORE, RPOP, RPOPLPUSH, RPUSH, RPUSHX
SADD, SDIFFSTORE, SELECT, SET, SETBIT, SETEX, SETNX, SETRANGE, SINTERSTORE, SMOVE, SPOP, SREM, SUNIONSTORE
ZADD, ZINCRBY, ZINTERSTORE, ZREM, ZREMRANGEBYLEX, ZUNIONSTORE, ZREMRANGEBYRANK, ZREMRANGEBYSCORE
XADD, XCLAIM, XDEL, XAUTOCLAIM, XGROUP CREATECONSUMER, XTRIM
Preparations for incremental data migration
To ensure that the incremental data migration task runs as expected, remove the limit on the replication output buffer. This topic uses a server that runs Linux as an example.
If you are performing only a full data migration, you can skip this step.
Use the redis-cli tool to connect to the self-managed Redis database.
NoteThe redis-cli tool is available after you install Redis. For more information, see the official Redis community website.
redis-cli -h <host> -p <port> -a <password>Note<host>: The endpoint of the self-managed Redis database. You can use 127.0.0.1.
<port>: The service port of the self-managed Redis database. The default port is 6379.
<password>: The password of the self-managed Redis database.
Example:
redis-cli -h 127.0.0.1 -p 6379 -a Test123456Run the following command to remove the limit on the replication output buffer:
config set client-output-buffer-limit 'slave 0 0 0'
Procedure
-
Navigate to the migration task list page for the destination region using one of the following methods.
From the DTS console
-
Log on to the Data Transmission Service (DTS) console.
-
In the navigation pane on the left, click Data Migration.
-
In the upper-left corner of the page, select the region where the migration instance is located.
From the DMS console
NoteThe actual operations may vary based on the mode and layout of the DMS console. For more information, see Simple mode console and Customize the layout and style of the DMS console.
-
Log on to the Data Management (DMS) console.
-
In the top menu bar, choose .
-
To the right of Data Migration Tasks, select the region where the migration instance is located.
-
-
Click Create Task to navigate to the task configuration page.
-
Configure the source and destination databases.
Category
Parameter
Description
N/A
Task Name
DTS automatically generates a task name. We recommend that you specify a descriptive name for easy identification. The name does not need to be unique.
Source Database
Select Existing Connection
-
To use a database instance that has been added to the system (created or saved), select the desired database instance from the drop-down list. The database information below will be automatically configured.
NoteIn the DMS console, this parameter is named Select a DMS database instance..
-
If you have not registered the database instance with the system, or do not need to use a registered instance, manually configure the database information below.
Database Type
Select Tair/Redis.
Access Method
Select an access method based on your source database's deployment location. This example uses Self-managed Database on ECS.
NoteIf the source instance is a self-managed database, you must also complete the required preparations.
Instance Region
Select the region where the ECS instance that hosts the source Redis database resides.
Replicate Data Across Alibaba Cloud Accounts
In this example, data is migrated within the same Alibaba Cloud account. Select No.
ECS Instance ID
Select the ID of the ECS instance that hosts the source Redis database.
NoteIf the source Redis database is in a cluster architecture, select the ECS instance ID where any master node resides. You must also manually add the DTS server CIDR block for the region to the security group rules of all other cluster instances. For more information, see Create a security group, Associate a security group with an instance (primary ENI), and Add the CIDR blocks for DTS servers to an IP address whitelist.
Instance Mode
Select Standalone or Cluster based on the architecture of the source Redis database.
NoteIf the Access Method for the self-managed Redis is Public IP Address, the Cluster mode is not supported for Instance Mode.
Port
Enter the service port of the source Redis database. The default value is 6379.
NoteIf the source Redis database is in a cluster architecture, enter the service port of any master node.
Authentication Method
Select an authentication method based on your requirements. In this example, Password Login is selected.
Note-
Only Redis 6.0 and later support Account + Password Login.
-
If you select Secret-free login, make sure that password-free access is enabled for the Redis database. For information about how to enable password-free access for a Tair (Redis OSS-Compatible) instance, see Enable password-free access over a VPC.
Database Password
Enter the password to connect to the source Redis database.
Note-
This parameter is optional. You can leave it empty if no password is set.
-
The password must be in the
<user>:<password>format. For example, if the custom username for the Redis instance isadminand the password isRp829dlwa, enteradmin:Rp829dlwa.
Encryption
Select Non-encrypted or SSL-encrypted based on your database instance requirements.
NoteIf you are using a self-managed Redis instance (the Access Method is not Alibaba Cloud Instance) and you select SSL-encrypted, you must also upload a CA Certificate and enter the CA Key.
Destination Database
Select Existing Connection
-
To use a database instance that has been added to the system (created or saved), select the desired database instance from the drop-down list. The database information below will be automatically configured.
NoteIn the DMS console, this parameter is named Select a DMS database instance..
-
If you have not registered the database instance with the system, or do not need to use a registered instance, manually configure the database information below.
Database Type
Select Tair/Redis.
Access Method
Select Alibaba Cloud Instance.
Instance Region
Select the region where the destination Tair (Redis OSS-Compatible) instance resides.
Replicate Data Across Alibaba Cloud Accounts
In this example, data is migrated within the same Alibaba Cloud account. Select No.
Instance ID
Select the ID of the destination Tair (Redis OSS-Compatible) instance.
Authentication Method
Select an authentication method based on your requirements. In this example, Password Login is selected.
Note-
Only Redis 6.0 and later support Account + Password Login.
-
If you select Secret-free login, make sure that password-free access is enabled for the Redis database. For information about how to enable password-free access for a Tair (Redis OSS-Compatible) instance, see Enable password-free access over a VPC.
Database Password
Enter the password to connect to the destination Tair (Redis OSS-Compatible) instance.
NoteThe password must be in the
<user>:<password>format. For example, if the custom username for the Tair instance isadminand the password isRp829dlwa, enteradmin:Rp829dlwa.Encryption
Select Non-encrypted or SSL-encrypted based on your database instance requirements.
NoteIf you are using a self-managed Redis instance (the Access Method is not Alibaba Cloud Instance) and you select SSL-encrypted, you must also upload a CA Certificate and enter the CA Key.
-
-
After you complete the configuration, click Test Connectivity and Proceed at the bottom of the page.
Note-
Ensure that the IP address segment of the DTS service is automatically or manually added to the security settings of the source and destination databases to allow access from DTS servers. For more information, see Add DTS server IP addresses to a whitelist.
-
If the source or destination database is a self-managed database (the Access Method is not Alibaba Cloud Instance), you must also click Test Connectivity in the CIDR Blocks of DTS Servers dialog box that appears.
-
-
Configure the task objects.
-
On the Configure Objects page, configure the objects that you want to migrate.
Parameter
Description
Migration Types
Select Full Data Migration + Incremental Data Migration.
NoteIf the account does not have
SYNCorPSYNCpermissions on the source database, select Full Data Migration.Processing Mode of Conflicting Tables
-
Precheck and Report Errors: Checks whether the destination is empty. If the destination to be migrated to is empty, the precheck is passed. If not, an error is reported during the precheck, and the data migration job does not start.
-
Ignore Errors and Proceed: Skips the Check the existence of objects in the destination database. check item.
WarningIf you select Ignore Errors and Proceed and a key in the destination has the same name as a key in the source during migration, the data from the source overwrites the data in the destination. This may cause data loss in the destination. Proceed with caution.
Source Objects
In the Source Objects box, click the objects to migrate, and then click
to move them to the Selected Objects box.NoteYou can select objects at the database level. If you need to migrate data for specific keys within a database, you can use the data filtering feature in the Selected Objects pane.
Selected Objects
To specify a destination database (DB 0 to DB 255) or filter data by prefix, use the mapping and filtering functions. In the Selected Objects box, right-click the database to migrate, and then configure the settings in the Edit Schema dialog box. For more information, see Map object names and Set filter conditions.
-
-
Click Next: Advanced Settings.
Parameter
Description
Dedicated Cluster for Task Scheduling
By default, DTS schedules tasks on a shared cluster. You do not need to select one. If you want more stable tasks, you can purchase a dedicated cluster to run DTS migration tasks.
Retry Time for Failed Connections
After the migration task starts, if the connection to the source or destination database fails, DTS reports an error and immediately begins to retry the connection. The default retry duration is 720 minutes. You can customize the retry time to a value from 10 to 1440 minutes. We recommend that you set the duration to more than 30 minutes. If DTS reconnects to the source and destination databases within the specified duration, the migration task automatically resumes. Otherwise, the task fails.
Note-
For multiple DTS instances that share the same source or destination, the network retry time is determined by the setting of the last created task.
-
Because you are charged for the task during the connection retry period, we recommend that you customize the retry time based on your business needs, or release the DTS instance as soon as possible after the source and destination database instances are released.
Retry Time for Other Issues
After the migration task starts, if a non-connectivity issue, such as a DDL or DML execution exception, occurs in the source or destination database, DTS reports an error and immediately begins to retry the operation. The default retry duration is 10 minutes. You can customize the retry time to a value from 1 to 1440 minutes. We recommend that you set the duration to more than 10 minutes. If the related operations succeed within the specified retry duration, the migration task automatically resumes. Otherwise, the task fails.
ImportantThe value of Retry Time for Other Issues must be less than the value of Retry Time for Failed Connections.
Enable Throttling for Full Data Migration
During full migration, DTS consumes read and write resources on the source and destination databases, which may increase the database load. If required, you can enable throttling for the full migration task. You can set Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s) to reduce the load on the destination database.
NoteThis parameter is available only if you select Full Data Migration for Migration Types.
Enable Throttling for Incremental Data Migration
If required, you can also choose to set speed limits for the incremental migration task. You can set RPS of Incremental Data Migration and Data migration speed for incremental migration (MB/s) to reduce the load on the destination database.
NoteThis parameter is available only if you select Incremental Data Migration for Migration Types.
Extend Expiration Time of Destination Database Key
Set an additional expiration time for keys when they are migrated from the source database to the destination database. To ensure data consistency, we recommend setting an extended key expiration time if commands such as the following are used.
NoteIn scenarios that involve distributed locks, this may prevent locks from being released in a timely manner.
expire key seconds pexpire key milliseconds expireat key timestamp pexpireat key timestampMsUse Slave Node
If the Instance Mode of the source self-managed Redis is Cluster, you can choose to read data from master or replica nodes. The default is No, which means data is read from master nodes.
Environment Tag
You can select an environment tag to identify the instance based on your requirements. In this example, no selection is needed.
Configure ETL
Choose whether to enable the extract, transform, and load (ETL) feature. For more information, see What is ETL? Valid values:
-
Yes: Enables the ETL feature. Enter data processing statements in the code editor. For more information, see Configure ETL in a data migration or data synchronization task.
-
No: Disables the ETL feature.
Monitoring and Alerting
Select whether to set alerts and receive alert notifications based on your business needs.
-
No: Does not set an alert.
-
Yes: Configure alerts by setting an alert threshold and an alert contact. If a migration fails or the latency exceeds the threshold, the system sends an alert notification.
-
Click Data Verification to configure a data verification task.
To use the data verification feature, see Configure data verification.
-
-
Save the task and run a precheck.
-
To view the parameters for configuring this instance when you call the API operation, move the pointer over the Next: Save Task Settings and Precheck button and click Preview OpenAPI parameters in the bubble that appears.
-
If you do not need to view or have finished viewing the API parameters, click Next: Save Task Settings and Precheck at the bottom of the page.
Note-
Before the migration task starts, DTS performs a precheck. The task starts only after it passes the precheck.
-
If the precheck fails, click View Details next to the failed check item, fix the issue based on the prompt, and then run the precheck again.
-
If a warning is reported during the precheck:
-
For check items that cannot be ignored, click View Details next to the failed item, fix the issue based on the prompt, and then run the precheck again.
-
For check items that can be ignored, you can click Confirm Alert Details, Ignore, OK, and Precheck Again to skip the alert item and run the precheck again. If you choose to ignore a warning, it may cause issues such as data inconsistency and pose risks to your business.
-
-
-
Purchase the instance.
When the Success Rate reaches 100%, click Next: Purchase Instance.
-
On the Purchase page, select the link specification for the data migration instance. For more information, see the following table.
Category
Parameter
Description
New Instance Class
Resource Group Settings
Select the resource group to which the instance belongs. The default value is default resource group. For more information, see What is Resource Management?
Instance Class
DTS provides migration specifications with different performance levels. The link specification affects the migration speed. You can select a specification based on your business scenario. For more information, see Data migration link specifications.
-
After the configuration is complete, read and select Data Transmission Service (Pay-as-you-go) Service Terms.
-
Click Buy and Start, and then click OK in the OK dialog box.
You can view the specific progress on the data migration page.
NoteIf your DTS instance is configured for both full and incremental migration (Migration Types includes both Full Data Migration and Incremental Data Migration), the task is listed as Incremental Data Migration on the migration task list page.