All Products
Search
Document Center

Tair (Redis® OSS-Compatible):Manually perform a primary/secondary switchover

Last Updated:Jan 27, 2026

Tair (Redis OSS-compatible) instances support manual primary/secondary switchovers. A manual switchover actively swaps the roles of the primary and secondary nodes. Unlike an automatic system failover, a manual switchover lets you control the instance in non-fault scenarios.

Scenarios

  • Disaster recovery drills: You can simulate a node failure during off-peak hours. This helps verify the disaster recovery capabilities and reliability of your application when a database switchover occurs.

  • Optimize access latency: If your application and the primary node are in different zones, you can perform a primary/secondary switchover. This moves the primary node to the same zone as your application. This nearest access deployment reduces network latency.

Scenario example

In this example, the application's ECS instance is in Zone B, and the Tair instance's primary node is in Zone A. The ECS instance must connect to the primary node across zones. This increases network latency and can affect instance performance and business operations.

可用区就近连接示例

To optimize the cloud resource deployment, you can perform a primary/secondary switchover to swap the roles of the nodes. After the switchover, the node in Zone B becomes the primary node. Note that only the node's role changes. Its zone and ID remain the same. This allows the ECS instance and the database instance to connect within the same zone, which minimizes network latency.

Prerequisites

The instance is a High Availability edition.

Note

The Single Copy edition does not support primary/secondary switchovers.

Impacts of a switchover

  • 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.

Note

About seamless switchovers

If your instance and client meet the following version requirements, you can perform a seamless primary/secondary switchover. This helps avoid the impact of transient disconnections and the read-only state on your business:

  • Instance version: 7.0.2.9 or later.

  • Client version: Valkey-Java 5.3.0 or later, or Valkey-Go 1.0.67 or later.

Procedure

  1. 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.

  2. In the navigation pane on the left, click Service Availability.

  3. In the Data Node area, select the data shard that you want to switch over and click Failover.

    Note

    If the instance uses the cluster architecture, you can view the zones of the primary and secondary nodes for each data shard on this page.

  4. In the panel that appears, select an effective time for the switchover.

    • Apply Immediately: The system performs the primary/secondary switchover immediately.

    • Effective Within Maintenance Window: The system performs the switchover during the maintenance window that you set. For more information about how to view and modify the maintenance window, see Set a maintenance window.

      Note

      If you select Effective Within Maintenance Window, the system immediately starts preparations, such as requesting resources and synchronizing data. The instance status changes to Switching, but this does not affect your services. The actual node role switchover and its associated impacts, such as transient disconnections and the read-only state, occur only when the Maintenance Window begins.

  5. Click OK.

    For security purposes, complete secondary authentication, such as Multi-Factor Authentication (MFA), as prompted. After you pass the authentication, you do not need to authenticate again for 15 minutes.

Related API operations

API operation

Description

SwitchInstanceHA - Perform an instance HA switchover

Manually performs a primary/secondary switchover. This is useful for disaster recovery drills and for enabling nearest access for applications in multi-zone deployments.

References

This topic describes how to manually perform a primary/secondary switchover. As a core component of high availability, Tair (Redis OSS-compatible) also supports automatic failover. The system continuously monitors the health of the nodes. If the primary node becomes unavailable, the system automatically triggers a failover to promote the secondary node to the new primary node. This process ensures high service availability. For more information, see High availability.