All Products
Search
Document Center

Tair (Redis® OSS-Compatible):Manually switch workloads from a master node to a replica node

Last Updated:Oct 24, 2024

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 your 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 uses the master-replica deployment model.

Note

A master-replica switchover is not supported for instances that use the standalone deployment model.

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 synchronization latency. To prevent potential data loss risks caused by the switchover and data doublewrite caused by the Domain Name System (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.

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 from the master node to the replica node to minimize network latency. After the manual switchover, the original replica node is promoted to become 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 and go to the Instances page. In the top navigation bar, select the region in which the instance that you want to manage resides. Then, find the instance and click the instance ID.

  2. In the left-side navigation pane, click Service Availability.

  3. In the Data Node section, select the data shard for which you want to perform a switchover and click Switchover.

    Note

    If the instance is a cluster instance, you can view the information about the zones in which the master and replica nodes of each data shard reside.

  4. 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 instance, see Configure a maintenance window.

  5. Click OK.

    Warning

    If you change the VPC or vSwitch of an instance, a transient connection that lasts approximately 30 seconds occurs. Make sure that you perform the operation during off-peak hours and your applications can automatically reconnect to the instance.

Related API 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 fails, ApsaraDB for Redis automatically triggers a master-replica switchover. For example, the roles of master and replica nodes are switched over to ensure the high availability (HA) of the instance. For more information, see Master-replica switchovers.