This topic describes how to switch workloads over between a primary ApsaraDB RDS for PostgreSQL instance and its secondary RDS instance. ApsaraDB RDS supports automatic primary/secondary switchovers and manual primary/secondary switchovers. After a primary/secondary switchover is complete, the original primary RDS instance runs as the new secondary RDS instance.

Prerequisites

The primary RDS instance runs RDS High-availability Edition.

Note
  • Primary RDS instances that run RDS Basic Edition do not have secondary RDS instances as standbys. Therefore, these primary RDS instances do not support primary/secondary switchovers.
  • You can disable automatic primary/secondary switchovers for a short period of time only for primary RDS instances that run RDS High-availability Edition with standard SSDs or enhanced SSDs (ESSDs).

Background information

  • Automatic switchover: The automatic switchover feature is enabled by default. If the primary RDS instance becomes faulty, ApsaraDB RDS automatically switches workloads over to the secondary RDS instance. For more information about the reasons due to which primary/secondary switchovers are triggered, see Reasons for primary/secondary switchovers.
  • Manual switchover: You can manually switch workloads over between the primary RDS instance and the secondary RDS instance even if the automatic switchover feature is enabled. You can perform manual switchovers for disaster recovery drills. You can also perform manual switchovers if you use the multi-zone deployment method and expect to connect to the RDS instance in the zone that is in close proximity to your application.
Note Data is synchronized between the primary RDS instance and the secondary RDS instance in real time. You can access only the primary RDS instance. The secondary RDS instance runs only as a standby and does not allow external access.

Impacts

  • You may encounter a transient connection during a primary/secondary switchover. Make sure that your application is configured to automatically reconnect to your database system.
  • If the primary RDS instance is attached with read-only RDS instances, the read-only RDS instances must re-establish the connections that are used for data replication and synchronize incremental data from the primary RDS instance after a primary/secondary switchover. As a result, the data on the read-only RDS instances shows latencies of a few minutes.
  • A primary/secondary switchover does not cause changes to the endpoints that are used to connect to your database system. Only the IP addresses that are associated with the endpoints may change. If your application connects to your database system by using endpoints, your application can still run as expected after a primary/secondary switchover.

Perform a manual primary/secondary switchover

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, click Service Availability.
  3. In the Availability Information section of the page that appears, click Switch Primary/Secondary Instance.
  4. Specify the point in time at which you want to perform a switchover. Then, click OK.
    Note During a primary/secondary switchover, you cannot perform specific operations. For example, you cannot manage databases and accounts or change the network type. We recommend that you select Switch Within Maintenance Window.

Disable automatic primary/secondary switchovers for a short period of time

The automatic switchover feature is enabled by default. If a primary RDS instance becomes faulty, ApsaraDB RDS automatically switches the workloads of the primary RDS instance over to the secondary RDS instance. You can disable the automatic switchover feature in the following scenarios:

  • A sales promotion during which you do not want a primary/secondary switchover to affect system availability
  • An important application upgrade during which you do not want a primary/secondary switchover to cause unexpected issues
  • A major event during which you do not want a primary/secondary switchover to affect system stability
  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, click Service Availability.
  3. In the Availability Information section of the page that appears, click Configure Primary/Secondary Switchover.
    Note If Configure Primary/Secondary Switchover is not displayed, you must check whether the RDS instance runs RDS High-availability Edition.
  4. Select Disable Temporarily, specify the Deadline parameter, and then click OK.
    Note
    • When the point in time that is specified by the Deadline parameter arrives, automatic primary/secondary switchovers are automatically enabled.
    • If you do not specify the Deadline parameter, automatic primary/secondary switchovers are disabled for one day. You can set the Deadline parameter to 23:59:59 seven days later at most.

After you disable the automatic switchover feature, you can go to the Service Availability page to check the deadline before which the automatic switchover feature remains disabled.

Related operations

Operation Description
Switch services between a primary ApsaraDB for RDS instance and its secondary instance Switches workloads over between primary and secondary ApsaraDB RDS instances.
Enable or disable automatic primary/secondary switchovers Enables or disables the automatic switchover feature for an ApsaraDB RDS instance.
Query settings of automatic primary/secondary switchover Queries the status of the automatic switchover feature for an ApsaraDB RDS instance.