What Are the Methods for Data Migration? What Precautions Should Be Taken During Migration?
Distributed Cache supports multiple data migration methods for different source scenarios:
Migration methods:
|
DTS online migration | Self-managed Redis / Redis on other cloud platforms / between Tencent Cloud instances | Supports full + incremental migration without stopping business writes. |
RDB file import (cold migration) | Has RDB backup files. | Upload via COS and import, suitable for offline scenarios. |
redis-shake tool | Self-managed Redis → Tencent Cloud | Open-source tool with high flexibility |
Precautions before migration:
1. Version compatibility: The Redis version of the target instance must be greater than or equal to that of the source instance. Migration from a higher version to a lower version is not supported.
2. Architecture differences: When migrating from the standard architecture to the cluster architecture, you must check whether your business code uses multi-key operations across slots (such as MGET, transactions, and cross-key Lua scripts). Such operations may fail in the cluster architecture.
3. Capacity planning: The memory specification of the target instance should be at least 1.5 times the used memory of the source instance, with Buffer space reserved.
4. Account and password: Verify that the connection address, port, and password of the source instance are accessible and not restricted by security groups.
5. Big Key check: If the source contains extremely large keys (for example, a single Value exceeding 512 MB), the migration task may time out or fail. Split these keys before migration.
Precautions during migration:
DTS migration consists of two phases: full sync and incremental sync. The source may experience additional load during the full sync phase, so you are advised to start the migration during off-peak hours.
During the incremental synchronization phase, the source bandwidth is continuously consumed by reading AOF/RDB streams. You are advised to monitor the source load.
After the migration is completed, manually run Migration Check to verify data consistency. After confirming that the data is correct, perform Complete Migration to cut off the sync channel.
Common causes of migration failures:
|
Source connection failed. | Check the source address, password, and security group configurations. |
Insufficient target capacity. | Expand the target instance capacity and then migrate again. |
Incompatible version. | Upgrade the target instance version. |
Big Key timeout. | Split the big Key and then retry. |
FLUSHALL executed on the source. | Clearing the source database during migration will cause data on the target end to be cleared, and a remigration is required. |