This topic describes how to switch workloads from a master node to a replica node. In addition to automatic switchovers, Tair (Redis OSS-compatible) 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 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.
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 remain 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 Tair (Redis OSS-compatible) instance resides in Zone A. The connection between the ECS instance and the master node of the Tair (Redis OSS-compatible) instance spans different zones. This increases network latency. This also affects the performance of the Tair (Redis OSS-compatible) 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.
Procedure
Log on to the 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.
In the left-side navigation pane, click Service Availability.
In the Data Node section, select the data shard for which you want to perform a switchover and click Switchover.
NoteIf 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.
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.
Click OK.
WarningIf 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
API operation | Description |
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 a Tair (Redis OSS-compatible) instance if the instance is deployed in multiple zones. |
References
Tair (Redis OSS-compatible) can monitor the health status of nodes. If the master node in an instance fails, a master-replica switchover is automatically triggered. For example, the roles of the master and replica nodes are switched over to ensure the high availability of the instance. For more information, see Master-replica switchovers.