Updated on 2024-06-20 GMT+08:00

IP Switching

Scenario

Currently, you cannot change the instance type when using the specification modification function. To modify instance specifications while changing the instance type, you can perform IP switching after data migration. By switching IP addresses, you can also change the AZ and CPU architecture used by an instance.

  • After online data migration is complete, you can switch the IP addresses.
  • The IP addresses can be rolled back as required after the switching.

Prerequisites

  • Obtain information about the source and target instances. For details about preparing a target instance, see Step 2: Prepare the Target DCS Redis Instance.
  • Ensure that the source and target instances can communicate with each other. For details, see Step 3: Check the Network.
  • The target and source instances must use the same port.
  • IP switching can be performed only when the following conditions are met:
    • IP switching depends on the data migration function. Therefore, the source and target instances must support the data migration function. For details, see Table 1.
    • Both the source and target instances are Redis instances in the cloud.
    • Table 1 lists the supported IP switching scenarios.
      Table 1 IP switching scenarios

      Source

      Target

      Single-node, read/write splitting, or master/standby

      Single-node, master/standby, read/write splitting, or Proxy Cluster

      Proxy Cluster

      Single-node, master/standby, read/write splitting, or Proxy Cluster

Precautions for IP Switching

  1. Online migration will stop during the switching.
  2. Instances will be read-only for one minute and disconnected for several seconds during the switching.
  3. The target and source instances must use the same port.
  4. If your application cannot reconnect to Redis or handle exceptions, you may need to restart the application after the IP switching.
  5. If the source and target instances are in different subnets, the subnet information will be updated after the switching.
  6. 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.
  7. 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.
  8. Ensure that the passwords of the source and target instances are the same. If they are different, verification will fail after the switching.
  9. If a whitelist is configured for the source instance, ensure that the same whitelist is configured for the target instance before switching IP addresses.

Switching IP Addresses

  1. Log in to the management console, and choose Application > Distributed Cache Service in the service list.
  2. Click in the upper left corner of the management console and select the region where your instance is located.
  3. In the navigation pane, choose Data Migration.
  4. Click Create Online Migration Task.
  5. Enter the task name and description.
  6. Configure the VPC, subnet, and security group for the migration task.

    The VPC, subnet, and security group facilitate the migration. Ensure that the migration resources can access the source and target Redis instances.

  7. Configure the migration task by referring to Configure the Online Migration Task. Set Migration Type to Full + Incremental.
  8. On the Online Migration page, when the migration task status changes to Incremental migration in progress, choose More > Switch IP in the Operation column.
  9. In the Switch IP dialog box, select whether to switch the domain name.

    • If a domain name is used, switch it or you must modify the domain name on the client.
    • If no domain name is used, the DNS of the instances will be updated.

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

Rolling Back IP Addresses

If you want to change the instance IP address to the original IP address, perform the following operations:

  1. Log in to the management console, and choose Application > Distributed Cache Service in the service list.
  2. Click in the upper left corner of the management console and select the region where your instance is located.
  3. In the navigation pane, choose Data Migration.
  4. On the Online Migration page, locate the row that contains the migration task in the IP switched state, choose More > Roll Back IP.
  5. In the confirmation dialog box, click Yes. The IP address rollback task is submitted successfully. When the task status changes to IP rolled back, the rollback is complete.