Self-Hosted Redis Migration with Backup Files
This section describes how to migrate self-hosted Redis to DCS by importing backup files.
Simply download the source Redis data and then upload the data to an OBS bucket in the same Huawei Cloud account and region as the target DCS Redis instance. After you have created a migration task on the DCS console, DCS will read data from the OBS bucket and data will be migrated to the target instance.
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.
Prerequisites
- Before migrating data, read through Migration Solution Notes to learn about the DCS data migration function and select an appropriate target instance.
- By default, a Proxy Cluster instance has only one database (DB0). Before you migrate data from a multi-DB single-node or master/standby instance to a Proxy Cluster instance, check whether any data exists on databases other than DB0. If yes, enable multi-DB for the Proxy Cluster instance by referring to Enabling Multi-DB.
- By default, a Redis Cluster instance has only one DB (DB0). Before you migrate data from a multi-DB single-node or master/standby instance to a Redis Cluster instance, check whether any data exists on databases other than DB0. To ensure that the migration succeeds, move all data to DB0 by referring to Online Migration from Another Cloud Using Rump.
- Prepare the source Redis backup file. The backup file must be in .aof, .rdb, .zip, or .tar.gz format.
- 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. For comparing migration data and reserving sufficient memory, you are advised to 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.
Creating an OBS Bucket and Uploading Backup Files
If the source Redis backup file to be uploaded is smaller than 5 GB, perform the following steps to create an OBS bucket and upload the file on the OBS console. If the backup file to be uploaded is larger than 5 GB, upload the file by referring to instructions.
- Create an OBS bucket on the OBS console.
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 in OBS User Guide.
- Region:
The OBS bucket must be in the same region as the target DCS Redis instance.
- Storage Class: Available options are Standard, Infrequent Access, and Archive.
Do not select Archive. Otherwise, the migration will fail.
- Region:
- In the bucket list, click the bucket created in 1.
- 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.
Creating a Migration Task
- Click in the upper left corner and choose Distributed Cache Service for Redis under Middleware to open 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 Redis 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 to migrate data from the specified DB in the source backup file. For example, if you enter 5, only data in DB5 will be migrated. To migrate all databases, do not specify Source DB.
- 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 Redis 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, 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 data is imported successfully, access the DCS instance and run the info command to check whether the data has been successfully imported as required. Connect to Redis by referring to redis-cli.
If the import fails, check the procedure. If the import command is incorrect, run the flushall or flushdb command to clear the cache data in the target instance, modify the import command, and try again.
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