You can use the rump tool to migrate data from Google Cloud Memorystore for Redis to ApsaraDB for Redis.

Prerequisites

  • An Elastic Compute Service (ECS) instance and an ApsaraDB for Redis instance are created in Alibaba Cloud, and they can communicate with each other through the internal network.
  • A public endpoint is configured so that you can access the ApsaraDB for Redis instance from the ECS instance over the Internet.
    Notice The public connection address is used only for data migration through the Internet. After data is migrated, clear the related public connection address and only access the ApsaraDB for Redis instance through the internal network to ensure data security.
  • The rump tool is downloaded in Google Compute Engine, and the owner of this file is granted the execute permission.

How it works

The rump tool uses the SCAN command to obtain the key list from the source Cloud Memorystore for Redis instance, and uses the DUMP command to retrieve the key content. Then, it uses the PTTL command to obtain the expiration time, and uses the RESTORE command to synchronize the keys to the destination instance through pipelines.
Note The rump tool does not support incremental migration.

Procedure

  1. Run the following command in Google Compute Engine to migrate data:
    ./rump -from source_addr -fromPwd source_pwd -to dest_addr -toPwd dest_pwd [-size size] [-replace]
    Table 1. Parameters for the rump tool
    Parameter Description
    source_addr The address of the source Cloud Memorystore for Redis instance, in the format of redis://host:port/db. Set this parameter to the private IP address of the Cloud Memorystore for Redis instance. The host and port fields are required. If the db field is not set, the default value 0 is used.
    source_pwd The password of the source Cloud Memorystore for Redis instance. You do not need to set this parameter if the Cloud Memorystore for Redis instance does not have a password.
    dest_addr The address of the destination ApsaraDB for Redis instance, in the format of redis://host:port/db. Set this parameter to the public connection address of the ApsaraDB for Redis instance. The host and port fields are required. If the db field is not set, the default value 0 is used.
    dest_pwd The password of the destination ApsaraDB for Redis instance.
    size The number of keys scanned and synchronized at a time. Default value: 10.
    replace Specifies whether to overwrite the existing keys in the destination ApsaraDB for Redis instance that are identical to those synchronized from the source Cloud Memorystore for Redis instance. If you do not set this parameter and any keys are duplicate in the source and destination databases, an error message is returned.
    Note If you set this parameter, make sure that you have backed up important data in the destination ApsaraDB for Redis instance to avoid data loss after overwriting.
    Figure 1. Migration example
    Use the rump tool to migrate data from Google Cloud Memorystore for Redis to ApsaraDB for Redis
  2. Check whether all data is migrated to the ApsaraDB for Redis instance.