Online Migration Between DCS Redis Instances
Application Scenarios
If the source and target instances are interconnected and the SYNC and PSYNC commands are supported by the source instance, data can be migrated online in full or incrementally from the source to the target.
- If the SYNC and PSYNC commands are disabled on the source Redis instance, enable them before performing online migration. Otherwise, the migration fails. If you use a HUAWEI CLOUD DCS Redis instance for online migration, the SYNC command is automatically enabled.
- You cannot use public networks for online migration.
Impacts on Services
During online migration, data is essentially synchronized in full to a new replica. Therefore, perform online migration during low-demand hours.
Prerequisites
- Before migrating data, read through Migration Tools and Schemes to learn about the DCS data migration function and select an appropriate target instance.
- To migrate data from a single-node or master/standby instance to a Redis Cluster instance, check if any data exists in DBs other than DB0 in the source instance. If yes, move the data to DB0. Otherwise, the migration will fail because a Redis Cluster instance has only one DB.
Step 1: Obtain the Source Redis Address
Obtain the IP address/domain name and port number of the source Redis instance.
Step 2: Prepare the Target DCS Redis Instance
- If a target DCS Redis instance is not available, create one first. For details, see Buying a DCS Redis Instance.
- If you already have a DCS Redis instance, you do not need to create one again, but you need to clear the instance data before the migration. For details, see Clearing DCS Instance Data.
If the target instance data is not cleared before the migration and the source and target instances contain the same key, the key in the target instance will be overwritten by the key in the source instance after the migration.
Step 3: Check the Network
- Check whether the source Redis instance, the target Redis instance, and the migration task are configured with the same VPC.
If yes, go to Step 5: Configure the Online Migration Task. If no, go to 2.
- Check whether the VPCs configured for the source Redis instance, the target Redis instance, and the migration task are connected to ensure that the VM resource of the migration task can access the source and target Redis instances.
- Perform the following operations to establish the network.
- If the source and target Redis instances are in the same region, create a VPC peering connection by referring to VPC Peering Connection .
- If the source and target Redis instances are in different regions, create a cloud connection by referring to Cloud Connect Getting Started.
- If the source and target Redis instances are on different clouds, create a connection by referring to Direct Connect documentation.
Step 4: Create an Online Migration Task
- Log in to the DCS console.
- In the navigation pane, choose Data Migration.
- Click Create Online Migration Task.
- Enter the task name and description.
- Configure the VPC, subnet, and security group for the migration task.
The VPC, subnet, and security group facilitate the migration. Ensure that the migration resources can access the source and target Redis instances.
Step 5: Configure the Online Migration Task
- On the Online Migration tab page, click Configure in the row containing the online migration task you just created.
- Select a migration type.
Supported migration types are Full and Full + Incremental, which are described in Table 1.
Table 1 Migration type description Migration Type
Description
Full
Suitable for scenarios where services can be interrupted. Data is migrated at one time. Source instance data updated during the migration will not be migrated to the target instance.
Full + incremental
Suitable for scenarios requiring minimal service downtime. The incremental migration parses logs to ensure data consistency between the source and target instances.
Once the migration starts, it remains Migrating until you click Stop in the Operation column. After the migration is stopped, data in the source instance will not be lost, but data will not be written to the target instance.
Figure 1 Selecting the migration type
- Configure source Redis and target Redis.
- Source Redis Type: Select Redis in the cloud or Self-hosted Redis as required.
- Redis in the cloud: a HUAWEI CLOUD DCS Redis instance that is in the same VPC as the migration task
- Self-hosted Redis: self-hosted Redis on HUAWEI CLOUD, in another cloud, or in on-premises data centers. If you select this option, enter Redis addresses.
- If the instance is password-protected, you can click Test Connection to check whether the instance password is correct and whether the network is connected.
- Source Redis Type: Select Redis in the cloud or Self-hosted Redis as required.
- For Target Redis Instance, select the DCS Redis Instance prepared in Step 2: Prepare the Target DCS Redis Instance.
If the instance is password-protected, you can click Test Connection to check whether the instance password meets the requirements.
- Confirm the migration task details and click Submit.
Go back to the data migration task list. After the migration is successful, the task status changes to Successful.
Once incremental migration starts, it remains Migrating until you click Stop.
If the migration fails, click the migration task and check the log on the Migration Logs page.
Verifying the Migration
After the migration is complete, use redis-cli to connect the source and target Redis instances to check data integrity.
- Connect to the source Redis and the target Redis.
- Run the info keyspace command to check the values of keys and expires.

- Calculate the difference between the values of keys and expires of the source Redis and the target Redis.
If the differences are the same, the data is complete and the migration is successful.
During full migration, source Redis data updated during the migration will not be migrated to the target instance.
Last Article: Migrating Data Between DCS Instances
Next Article: Backup Migration Between Regions or Redis Versions
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.