Backup Import Between DCS Redis Instances
You can migrate data between DCS instances by importing backup files.
Notes and Constraints
- To migrate to an instance with SSL enabled, disable the SSL setting first. For details, see Transmitting DCS Redis Data with Encryption Using SSL.
- Migration may fail if the target instance uses smaller specifications than its source.
Prerequisites
- You have successfully backed up the source Redis instance.
- For Importing Backup Data from a Redis Instance, you do not need to download the backup file to the local PC. For details about how to back up data, see Manually Backing Up a DCS Instance.
- For Importing Backup Data from an OBS Bucket, download the backup file to the local PC by referring to Downloading a Backup File.
- You have prepared the target Redis instance. If a target DCS Redis instance is not available, create one first. For details, see Buying a DCS Redis Instance.
Redis is backward compatible. The target instance version must be the same as or later than the source instance version.
- Ensure that the target Redis instance has sufficient storage space. You can clear the instance data before the migration. For details, see Clearing DCS Instance Data. If any data exists on the target instance, duplicate data between the source and target is overwritten. If the data exists only on the target instance, the data will be retained.
Procedure
- If the source Redis and target Redis are in the same region under the same DCS account, and the source Redis is not a single-node instance, see Importing Backup Data from a Redis Instance.
- If the source Redis and target Redis are in different regions or under different DCS accounts, or the source Redis is a single-node instance, see Importing Backup Data from an OBS Bucket.
- Log in to the DCS console.
- Click
in the upper left corner of the console and select the region where your source and target instances are located.
- In the navigation pane, choose Data Migration. The migration task list is displayed.
- Click Create Backup Import Task.
- Enter the task name and description.
The task name must start with a letter, contain 4 to 64 characters, and contain only letters, digits, hyphens (-), and underscores (_).
- For source Redis, set Data Source to Redis.
- For Source Redis Instance, select the source instance to be migrated.
- You can specify Source DB (Optional) to migrate data from the specified DB in the source Redis backup file. For example, if you enter 5, only data in DB5 will be migrated. To migrate all databases, do not specify it.
- Enable Multi-DB Proxy Cluster if the source Redis is a multi-DB (multi-db set to yes) Proxy Cluster DCS Redis instance.
- Select the backup task whose data is to be migrated.
- For Target Redis Instance, select the DCS Redis instance prepared in Prerequisites.
- If the target Redis instance has a password, enter the password and click Test Connection to check whether the password is correct. If the instance is not password-protected, click Test Connection directly.
- For Target DB (Optional), you can specify a DB in the target Redis to migrate data to. For example, if you enter 5, data will be migrated to DB5 of the target Redis. If you do not specify a DB, data will be migrated to a DB corresponding to the source DB.
If the source Redis is multi-DB and the target is single-DB (DB0), either ensure that all source data is in DB0, or specify a source DB and set the target DB to 0. Otherwise, migration will fail. For details about DB in DCS for Redis, see Does DCS for Redis Support Multi-DB?.
- Click Next.
- 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.
Simply download the source Redis data and then upload the data to an OBS bucket in the same account and region as the target DCS Redis instance. After you have created a backup import task, data in the OBS bucket will be read and migrated to the target Redis.
- .aof, .rdb, .zip, and .tar.gz files can be uploaded to OBS buckets. You can directly upload .aof and .rdb files or compress them into .zip or .tar.gz files before uploading.
- To migrate data from a cluster Redis instance, download all backup files and upload all of them to the OBS bucket. Each backup file contains data for a shard of the instance. During the migration, you need to select backup files of all shards.
- Create an OBS bucket in the account and region where the target Redis instance is located. If a qualified OBS bucket is available, you do not need to create one.
When creating an OBS bucket, pay attention to the configuration of the following parameters. For details on how to set other parameters, see Creating a Bucket.
- Region:
The OBS bucket must be in the same region as the target DCS Redis instance.
- Default Storage Class: Select Standard or Infrequent Access.
Do not select Archive. Otherwise, the migration will fail.
- Region:
- Upload the backup file to the OBS bucket. If the backup file to be uploaded is larger than 5 GB, follow the instructions provided by OBS. If the backup file to be uploaded is smaller than 5 GB, refer to the following instructions.
- In the bucket list, click the name of the created bucket.
- In the navigation pane, choose Objects.
- On the Objects tab page, click Upload Object.
- Specify Storage Class.
Do not select Archive. Otherwise, the migration will fail.
- Upload the objects.
Drag files or folders to the Upload Object area or click add file.
A maximum of 100 files can be uploaded at a time. The total size cannot exceed 5 GB.
Figure 1 Uploading an object - Specify Server-Side Encryption. If you enable it, you can select SSE-KMS or SSE-OBS. You can also disable it. For details, see Server-Side Encryption.
- Click Upload.
- Log in to the DCS console.
- In the navigation pane, choose Data Migration.
- Click Create Backup Import Task.
- Enter the task name and description.
The task name must start with a letter, contain 4 to 64 characters, and contain only letters, digits, hyphens (-), and underscores (_).
- In the Source Data area, select OBS bucket for Data Source and then select the OBS bucket to which you have uploaded backup files.
- You can specify Source DB (Optional) to migrate data from the specified DB in the source Redis backup file. For example, if you enter 5, only data in DB5 will be migrated. To migrate all databases, do not specify it.
- Enable Multi-DB Proxy Cluster if the source Redis is a multi-DB (multi-db set to yes) Proxy Cluster DCS Redis instance.
- Click Add Backup and select the backup files to be migrated.
- In the Target Data area, select the Target Redis Instance prepared in Prerequisites.
- If the target Redis instance has a password, enter the password and click Test Connection to check whether the password is correct. If the instance is not password-protected, click Test Connection directly.
- For Target DB (Optional), you can specify a DB in the target Redis to migrate data to. For example, if you enter 5, data will be migrated to DB5 of the target Redis. If you do not specify a DB, data will be migrated to a DB corresponding to the source DB.
If the source Redis is multi-DB and the target is single-DB (DB0), either ensure that all source data is in DB0, or specify a source DB and set the target DB to 0. Otherwise, migration will fail. For details about DB in DCS for Redis, see Does DCS for Redis Support Multi-DB?.
- Click Next.
- 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.
Verifying the Migration
After the migration is complete, check data integrity in the following way.
- Connect the source Redis and the target Redis. For details, see redis-cli.
- Run the info keyspace command on the source and the target Redis to check the values of keys and expires.
Figure 2 Checking instance data
- Calculate the differences 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.
Related Documents
- To migrate data by calling APIs, see Data Migration.
- FAQs
- Can I Migrate Data from a Lower Redis Version to a Higher One?
- Will the Same Keys Be Overwritten During Data Migration or Backup Import?
- Handling Migration Errors
- Troubleshooting Data Migration Failures
- Why Does Redis Cluster Migration Fail If It Uses Built-in Keys and Cross-Slot Lua Scripts?
- Can I Migrate Data to Multiple Target Instances in One Migration Task?
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot