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.
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).
- 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.
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.
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.
- 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 is deployed. Then, find the instance and click the instance ID.
- In the left-side navigation pane, click Service Availability.
- In the Zone Distribution section, select the data shard for which you want to perform a switchover, and click
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.
- 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 Set a maintenance window.
- Click OK.
Related API operations
|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.|
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 Causes and impacts of master-replica switchovers.