Updated on 2024-12-16 GMT+08:00

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.

Prerequisites

  • You have successfully backed up the source Redis instance.
  • 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.

Importing Backup Data from a Redis Instance

  1. Log in to the DCS console.
  2. Click in the upper left corner of the console and select the region where your source and target instances are located.
  3. In the navigation pane, choose Data Migration. The migration task list is displayed.
  4. Click Create Backup Import Task.
  5. 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 (_).

  6. For source Redis, set Data Source to Redis.

    Figure 1 Selecting a data source (Redis)

  7. For Source Redis Instance, select the source instance to be migrated.
  8. You can specify Source DB 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 Source DB.
  9. Enable Multi-DB Proxy Cluster if the source Redis is a multi-DB (multi-db set to yes) Proxy Cluster DCS Redis instance.
  10. Select the backup task whose data is to be migrated.
  11. For Target Redis Instance, select the DCS Redis instance prepared in Prerequisites.
  12. 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.
  13. 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?

  14. Click Next.
  15. 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.

Importing Backup Data from an OBS Bucket

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.
  1. 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.

  2. Upload the backup file to the OBS bucket.

    1. In the bucket list, click the name of the created bucket.
    2. In the navigation pane, choose Objects.
    3. On the Objects tab page, click Upload Object.
    4. Specify Storage Class.

      Do not select Archive. Otherwise, the migration will fail.

    5. 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 2 Uploading an object
    6. 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.
    7. Click Upload.

  3. Click in the upper left corner and choose Distributed Cache Service for Redis under Middleware to open the DCS console.
  4. In the navigation pane, choose Data Migration.
  5. Click Create Backup Import Task.
  6. 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 (_).

  7. In the Source Redis area, select OBS Bucket for Data Source and then select the OBS bucket to which you have uploaded backup files.

    Figure 3 Selecting a data source (OBS bucket)

  8. You can specify Source DB 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 Source DB.
  9. Enable Multi-DB Proxy Cluster if the source Redis is a multi-DB (multi-db set to yes) Proxy Cluster DCS Redis instance.
  10. Click Add Backup and select the backup files to be migrated.
  11. In the Target Redis area, select the Target Redis Instance prepared in Prerequisites.
  12. 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.
  13. 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?

  14. Click Next.
  15. 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.