Migrate data from Tair (Redis OSS-compatible) to ApsaraMQ for Kafka
Data Transmission Service (DTS) supports migrating data from Redis to Kafka. This topic describes how to migrate data from an Tair (Redis OSS-Compatible) instance to a ApsaraMQ for Kafka instance.
This feature is in beta testing and is available only to select users.
Prerequisites
Create a destination ApsaraMQ for Kafka instance.
NoteFor more information about the database versions supported by the source and destination databases, see Migration scenarios.
In the destination ApsaraMQ for Kafka instance, create a topic.
Precautions
|
Type |
Description |
|
Source database limitations |
|
|
Other limitations |
|
The current migration link does not support the ETL feature.
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. |
Supported commands for incremental data migration
DTS supports the following Redis commands during 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
Permissions required for database accounts
Database | Required permissions | Method to create and grant permissions |
Source Tair (Redis OSS-Compatible) instance | Read permission |
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
Configuration
Description
None
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 Alibaba Cloud Instance.
Instance Region
Select the region where the source Tair (Redis OSS-Compatible) instance resides.
Replicate Data Across Alibaba Cloud Accounts
This example describes migration between instances that belong to the same Alibaba Cloud account. Select No.
Instance ID
Select the ID of the source Tair (Redis OSS-Compatible) instance.
Authentication Method
Select an authentication method based on your requirements. In this example, Password Login is selected.
NoteOnly 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 of the database account that is used to connect to the source Tair (Redis OSS-Compatible) instance. The account must have the read permission.
Default account: Enter the password.
New account: Enter the password in the
<custom_account>:<password>format. For example, if the custom username of the Redis instance is admin and the password is Rp829dlwa, enter admin: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 Certificate Password.
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 Kafka.
Access Method
Select Alibaba Cloud Instance.
Instance Region
Select the region where the destination Kafka instance resides.
Kafka Instance ID
Select the ID of the destination Kafka instance.
Encryption
Select Non-encrypted or SCRAM-SHA-256.
Topic
Select the topic that is used to receive data from the drop-down list.
Use Kafka Schema Registry
Kafka Schema Registry is a metadata service layer that provides a RESTful interface to store and retrieve Avro schemas.
No: Do not use Kafka Schema Registry.
Yes: Use Kafka Schema Registry. You must enter the URL or IP address that is used to register the Avro schema in Kafka Schema Registry.
-
-
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.
Configuration
Description
Migration Types
Select both Full Data Migration and Incremental Data Migration (or select Full Data Migration + Incremental Data Migration). If the account that you use to configure the DTS instance does not have the SYNC or PSYNC permission on the source database, select Full Data Migration.
Processing Mode of Conflicting Tables
No configuration is required. Keep the default value.
Data Format in Kafka
Select the storage format for data migrated to the Kafka instance.
If you select DTS Avro, you must parse the data based on the DTS Avro schema definition. For more information, see DTS Avro schema definition and DTS Avro deserialization example.
If you select Canal JSON, see Canal JSON Description for parameter details and examples.
If you select Shareplex JSON, see Shareplex JSON for parameter details and examples.
Kafka Data Compression Format
Select a compression format for Kafka messages based on your requirements.
LZ4 (default): low compression ratio, high compression speed.
GZIP: high compression ratio, low compression speed.
NoteHigh CPU consumption.
Snappy: medium compression ratio, medium compression speed.
Policy for Shipping Data to Kafka Partitions
Select a policy.
Message acknowledgement mechanism
Select a Message acknowledgement mechanism.
Topic That Stores DDL Information
Select the topic for storing DDL information.
NoteIf no topic is selected, DTS stores DDL information in the data topic by default.
Source Objects
In the Source Objects box, click the objects to migrate, and then click
to move them to the Selected Objects box.NoteSource objects are selected by databases. If you want to migrate only partial data that matches specific keys, use the data filtering feature in the Selected Objects field.
Selected Objects
No additional configuration is required in this example.
You can use the mapping feature to set the topic name, number of partitions, and additional columns for each source database (DB 0 to DB 255) in the destination Kafka instance. For more information, see Configure mapping information.
Click Next: Advanced Settings.
Configuration
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 option is available only when the values of Migration Types include Full Data Migration.
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 option is available only when the values of Migration Types include Full Data Migration.
Use Slave Node
No configuration is required in this example.
If the source database is a self-managed Redis database and the Instance Mode is Cluster, you can choose to read data from the primary or secondary node. The default value is No, which means data is read from the primary node.
Environment Tag
You can select an environment tag to identify the instance as needed. No selection is required in this example.
Configure ETL
The current migration link does not support the ETL feature. No configuration is required.
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.
-
-
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 Purchase And Start, and then click OK in the OK dialog box.
You can view the progress on the data migration page.
NoteIf the DTS instance that you configure contains both full and incremental migration tasks (Migration Types includes both Full Data Migration and Incremental Data Migration), the tasks are merged and displayed as Incremental Data Migration.
Configure mapping information
In the Selected Objects box, right-click the selected migration object.
In the Edit Schema dialog box, configure the mapping information.
Configuration
Description
Name of target Topic
The name of the topic that receives data in the destination Kafka instance. By default, this is the Topic that you selected in the Destination Database section during the Configurations for Source and Destination Databases step.
ImportantThe specified topic name must exist in the destination Kafka instance. Otherwise, the data migration fails.
If you modify the Name of target Topic, the data is written to the topic that you specify.
Number of Partitions
The number of partitions for the destination topic to which data is written.
Prefixes of Keys to Be Synchronized
For more information, see Filter task data with an SQL condition.
Prefixes of Keys to Be Filtered Out
Additional Columns
For more information, see Add additional columns.
Click OK.