This topic describes how to switch workloads from a master node to a replica node. In addition to automatic switchovers, ApsaraDB for Redis allows you to manually switch workloads from a master node to a replica node. Manual switchovers can help you perform disaster recovery drills and verify the error processing capabilities of clients. If the ApsaraDB for Redis instance is deployed in multiple zones, you can also perform a manual switchover to allow applications to connect to the nearest node.

Prerequisites

The instance is an ApsaraDB for Redis Community Edition instance or a performance-enhanced or hybrid-storage instance of ApsaraDB for Redis Enhanced Edition (Tair). For more information, see Performance-enhanced instances and Hybrid-storage instances (phased out).

Impacts

  • The data nodes on which the switchover is performed are disconnected for a few seconds. A switchover has potential data loss risks. For example, the data may become inconsistent between the master and replica nodes due to the sync latency. To prevent potential data loss risks caused by the switchover and data doublewrite caused by the DNS cache, the data nodes become read-only for up to 30 seconds
  • After an instance enters the Switching state, you cannot manage this instance. For example, you cannot modify the instance configurations or migrate the instance to another zone.

Scenario

In the following example, the Elastic Compute Service (ECS) instance on which your applications are deployed resides in Zone B, and the master node of the ApsaraDB for Redis instance resides in Zone A. The connection between the ECS instance and the master node of the ApsaraDB for Redis instance spans different zones. This increases network latency. This also affects the performance of the ApsaraDB for Redis instance and your business.

Example of a connection in the same zone

To optimize the deployment architecture of cloud resources, you can switch your workloads from the master node to the replica node to minimize network latency. After the manual switchover, the original replica node is promoted to the new master node. The manual switchover does not cause changes to the zones and IDs of the master node and replica node.

Procedure

  1. Log on to the ApsaraDB for Redis console.
  2. In the top navigation bar of the page, select the region where the instance is deployed.
  3. On the Instances page, click the ID of the instance.
  4. In the left-side navigation pane, click Service Availability.
  5. In the Zone Distribution section, select the data shard for which you want to perform a switchover, and click Switchover.
    Switchover
    Note If the ApsaraDB for Redis instance is a cluster instance, you can view the information about the zones to which the master node and replica node of each data shard belong. For more information, see Master-replica cluster instances.
  6. In the panel that appears, select the time when you want to perform the switchover.
    • Immediate: performs the switchover immediately.
    • Maintenance Window: performs the switchover within the specified maintenance window. For more information about how to view and modify the maintenance window of an ApsaraDB for Redis instance, see Specify a maintenance window.
  7. Click OK.

Related operations

Operation Description
SwitchInstanceHA Manually switches workloads from a master node to a replica node. This operation can be used for disaster recovery drills. This operation can also be used for nearby connections between your applications and an ApsaraDB for Redis instance if the instance is deployed in multiple zones.

References

ApsaraDB for Redis can monitor the health status of nodes. If a master node in an instance becomes unavailable, ApsaraDB for Redis automatically triggers a master-replica switchover. The roles of master and replica nodes are switched over to ensure high availability of the instance. For more information, see Causes and impacts of master-replica switchovers.