All Products
Search
Document Center

ApsaraDB RDS:Switch between a disaster recovery instance and a primary instance

Last Updated:Dec 04, 2025

If all nodes of the primary instance in a disaster recovery instance group become unavailable, for example, when both the primary and secondary nodes are down, you can switch the disaster recovery instance to the primary role. After the switch, the previously read-only disaster recovery instance becomes the read-write primary instance. The original primary instance becomes a read-only disaster recovery instance. This switch quickly restores service access for your application. This is useful for scenarios such as disaster recovery drills, geo-disaster recovery switchovers, and rapid data migration.

Prerequisites

The disaster recovery instance group must be in the Running state.

Notes

  • In a disaster recovery scenario, if the region of the primary instance is unavailable or if data latency between the instances prevents a standard switch, you can promote the disaster recovery instance to a primary instance to quickly restore read and write operations based on your business needs.

  • The switch triggers a transient connection that lasts for approximately 10 seconds. Perform the switch during off-peak hours and ensure that your application has an automatic reconnection mechanism.

  • Data consistency between the primary and disaster recovery instances is strictly checked during the switch. Data loss does not typically occur during a planned switch. However, if data latency exists between the instances and a full sync does not complete within 5 minutes of initiating the switch, the operation fails. This mechanism ensures data consistency.

  • After the switch is complete, connections to the endpoint of the original primary instance become read-only. You must change the endpoint in your application to the endpoint of the new primary instance. You must also configure the network settings between your application and the new primary instance. For example, set an IP whitelist and verify network connectivity.

Procedure

  1. Navigate to the Global Database page.

  2. On the Global Distributed Cache page, click the instance ID of the target instance group.

  3. In the List of RDS instances section at the bottom of the page, find the instance that has the secondary role, and then click Switch to Primary Instance in the Actions column.

  4. Review the information about the effects of the role switch, and then click Switch.

    • During the switch, the status of the disaster recovery instance group changes to Switching Instance. The process takes less than 10 minutes to complete.

    • After the switch is complete, the primary and secondary roles are swapped, and the data synchronization direction is inverted. The following table shows an example:

      Item

      Before switch

      After switch

      Primary/Secondary role

      Primary instance: read-write. Disaster recovery instance: read-only.

      The disaster recovery instance becomes the primary instance. The original primary instance becomes the disaster recovery instance.

      Data synchronization direction

      From the primary instance to the disaster recovery instance

      From the disaster recovery instance to the primary instance