This topic describes how to switch your workloads over from a master node to a replica node. ApsaraDB for Redis supports both automatic failovers and manual switchovers. You can also manually switch your workloads over from a master node to a replica node to 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 based on your business deployment. This way, your applications can connect to the nearest nodes of the ApsaraDB for Redis instance.

Prerequisites

The ApsaraDB for Redis instance runs the ApsaraDB for Redis Community Edition or ApsaraDB for Redis Enhanced Edition (Tair). For more information, see Performance-enhanced instances and Hybrid-storage instances (phased out).

Impact

  • When you switch your workloads over from a master node to a replica node, the master node and the replica node are forced into the read-only state and transient connections occur. The read-only state and transient connections last a few minutes. Make sure that your applications are configured to automatically reconnect to the ApsaraDB for Redis instance.
  • If the ApsaraDB for Redis instance is in the Switching state, you cannot manage the instance. For example, you cannot change the specifications of the instance or migrate the instance to other zones.

Scenarios

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 over 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 node 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 Cluster master-replica instances.
  6. In the pane that appears, select the time when you want to perform the switchover.
    • Immediate: ApsaraDB for Redis performs the switchover immediately.
    • Maintenance Window: ApsaraDB for Redis 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 Performs a switchover between a master node and 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 statuses of nodes. If a master node becomes unavailable, ApsaraDB for Redis can fail over to the replica node of the master node to ensure high availability. For more information, see Causes and impacts of master-replica switchovers.