Updated on 2024-10-28 GMT+08:00

Upgrading a Redis 3.0 Instance

Overview

Redis has not updated Redis 3.0 since the release of a minor version on May 19, 2019. Huawei Cloud DCS also announced the discontinuation of DCS for Redis 3.0 in March 2021.

You are advised to upgrade your DCS Redis 3.0 to a later version as soon as possible. DCS for Redis 4.0/5.0/6.0 are compatible with Redis 3.0.

Currently, DCS does not support direct instance upgrades. In this case, migrate the data of the earlier instance to that of a later one. Follow the instructions below to upgrade a DCS Redis 3.0 instance by migrating data and switching IPs.
  • DCS Redis 3.0 instances support public access, while DCS Redis 4.0/5.0/6.0 instances do not. If your services rely on public access, do not perform the upgrade.
  • Upgrading the Redis version through data migration may have the following impacts on services:
    • The source and target Redis instance IP addresses need to be switched after data migration is complete. During the switching, the instances will become read-only within 1 minute and be interrupted for 30 seconds.
    • If the target instance does not share the password as the source, the password needs to be updated after data synchronization is complete. Stop the services during the update. In this case, you are advised to use the same password for the source and target instances.
  • Upgrade instances during off-peak hours.

Prerequisites

  • You have created a DCS Redis instance of a later version. This instance must be in the same VPC and subnet, of the same instance type, configured with the same password as the source instance, and have specifications greater than or equal to the source instance. For example, to upgrade a 16 GB master/standby DCS Redis 3.0 instance to a DCS Redis 5.0 one, prepare a master/standby DCS Redis 5.0 instance with at least 16 GB memory.

    For details about how to create a DCS Redis instance, see Buying a DCS Redis Instance.

  • You have manually backed up data of the source DCS Redis 3.0 instance. For details about how to back up data, see How Do I Export DCS Redis Instance Data?.

Migrating Instance Data

  1. Log in to the DCS console.
  2. Click in the upper left corner of the console and select the region where your source instance is located.
  3. In the navigation pane, choose Data Migration. The migration task list is displayed.
  4. In the upper right corner, click Create Online Migration Task.
  5. Enter the task name and description.
  6. Configure the VPC, subnet, and security group for the migration task.

    • Select the VPC where the source and target Redis instances are, so they can be connected with the task.
    • The migration task uses a tenant IP address (Migration ECS displayed on the Basic Information page of the task). If the target Redis has an IP whitelist, this IP address must be added to the whitelist.
    • To allow the VM used by the migration task to access the source and target instances, set an outbound rule for the task's security group to allow traffic through the IP addresses and ports of the source and target instances. By default, all outbound traffic is allowed.

  7. After the migration task is created, click Configure in the Operation column of the task on the Online Migration tab page to configure the source Redis and target Redis.
  8. Select Full + Incremental for Migration Type. IP switching can be performed on the console only for instances using full and incremental migration. Selecting Full requires a manual IP change of the Redis instance.

    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. When the transmission network is stable, the delay of incremental migration is within seconds. The actual delay depends on the transmission quality of the network link.

  9. If Migration Type is set to Full + Incremental, you can specify a bandwidth limit.

    The data synchronization rate can be kept around the bandwidth limit.

  10. Specify Auto-Reconnect. If this option is enabled, automatic reconnections will be performed indefinitely in the case of a network exception.

    Full synchronization will be triggered and requires more bandwidth if incremental synchronization becomes unavailable. Exercise caution when enabling this option.

  11. For Source Redis and Target Redis, select the Redis 3.0 instance to be upgraded and the new Redis instance.
  12. If the source and target Redis instances are password-protected, enter Source Redis Instance Password and Target Redis Instance Password, and click Test Connection respectively to check whether the network can be connected. If the source and target Redis instances are password-free, click Test Connection.
  13. Source DB and Target DB specify migration databases. For example, if you enter 5 for source DB and 6 for target DB, data in DB5 of the source Redis will be migrated to the DB6 of the target Redis. If the source DB is not specified but the target DB is specified, all source data will be migrated to the specified target DB by default. If the target DB is not specified, data will be migrated to the corresponding target DB. Leave Source DB and Target DB blank in this operation.
  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.

    • Once incremental migration starts, it remains Migrating.
    • To manually stop migration, click Stop.
    • After data migration, duplicate keys will be overwritten.

    If the migration fails, click the migration task and check the log on the Migration Logs page.

Verifying the Migration

Before data migration, if the target Redis has no data, check data integrity after the migration is complete in the following way:

  1. Connect to the source Redis and the target Redis. Connect to Redis by referring to redis-cli.
  2. Run the info keyspace command to check the values of keys and expires.

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

During full migration, source Redis data updated during the migration will not be migrated to the target instance.

Switching DCS Instance IPs

The prerequisites for switching source and target Redis instance IP addresses are as follows. The target Redis can be accessed automatically on a client after the switch.

  • The source and target must be basic edition Redis instances excluding Redis Cluster ones. This function is unavailable for professional edition and Redis Cluster instances.
  • For sources of DCS Redis 3.0 instances, contact the administrator to enable the whitelist for Redis 3.0 instance IP switches. The instance IP addresses can be switched only when the source instance is a DCS Redis 3.0 instance and the target instance is a basic edition DCS Redis 4.0, 5.0, or 6.0 instance.
  • The IP addresses of a source or target instance with public access enabled cannot be switched on the console. Manually change the IP addresses if needed.
  • Full + Incremental must be selected in 8.
  • The source and target Redis instance ports must be consistent.
  1. IP switching stops online migration tasks.
  2. When the source is a Redis 3.0 instance, the instance will be read-only for one minute and disconnected for 30 seconds during an IP switch.
  3. If your application cannot reconnect to Redis or handle exceptions, you may need to restart the application after the IP switching.
  4. If the source is a master/standby instance, the IP address of the standby node will not be switched. Ensure that this IP address is not used by your applications.
  5. If your applications use a domain name to connect to Redis, the domain name will be used for the source instance. Select Yes for Switch Domain Name.
  6. Ensure that the passwords of the source and target instances are the same. If they are different, verification will fail after the switching.
  7. After the IP addresses of a DCS Redis 3.0 instance are switched, synchronize the security group of the source to the whitelist of the target.
  1. On the Data Migration > Online Migration page, when the migration task status changes to Incremental migration in progress, choose More > Switch IP in the Operation column.
  2. In the Switch IP dialog box, select whether to switch the domain name.

    • If a Redis domain name is used on the client, switch it or you must modify the domain name on the client.
    • If the domain name switch is not selected, only the instance IP addresses will be switched.

  3. Click OK. The IP address switching task is submitted successfully. When the status of the migration task changes to IP switched, the IP address switching is complete.

Verifying Service Functions

  • Verify that service functions are normal. For example, check whether an error is reported when the client accesses Redis.
  • Check whether key performance metrics are normal, such as Connected Clients, Ops per Second, CPU Usage, and Memory Usage.