This topic describes how to manually or automatically switch over services between the RDS PostgreSQL master and slave instances. After the switchover, the master instance becomes the slave instance.

Prerequisites

The RDS instance runs the High-availability Edition.

Note
  • RDS instances that run the Basic Edition do not have secondary instances and do not support primary/secondary switchovers.
  • Only high-availability edition cloud disk instances support temporarily disabling the automatic switch function.

Background information

  • Automatic switchover: By default, the automatic switchover feature is enabled. If the primary RDS instance becomes faulty, ApsaraDB RDS automatically switches workloads over to the secondary RDS instance.
  • Manual switchover: You can manually switch workloads over between the primary and secondary RDS instances even if the automatic switchover feature is enabled.
Note Data is synchronized in real time between the primary and secondary RDS instances. You can access only the primary RDS instance. The secondary RDS instance serves only as a standby and does not allow external access.

Precautions

  • You may encounter a transient connection during a 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 need to re-establish the connections that are used for data replication and synchronize incremental data after a switchover. As a result, data on the read-only RDS instances shows latencies of a few minutes.

Perform a manual switchover of services between a primary RDS instance and its secondary instance

  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 time when you want to perform a switchover. Then, click OK.
    Note A number of operations cannot be performed during the switchover. For example, you cannot manage databases or accounts, and you cannot change the network type. We recommend that you select Switch Within Maintenance Window.

Temporarily disable 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. However, you can disable the automatic switchover feature in the following scenarios:
  • A sales promotion, during which you do not want a switchover to affect system availability.
  • An important application upgrade, during which you do not want a switchover to cause unexpected issues.
  • A major event that requires stable system operation, during which you do not want a 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 you cannot find Configure Primary/Secondary Switchover, you must check that your RDS instance runs the RDS High-availability Edition.
  4. Select Disable Temporarily, set the Deadline parameter, and then click OK.
    Note
    • When the specified Deadline arrives, the automatic switchover feature is automatically enabled for your RDS instance.
    • By default, the automatic switchover feature is 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 is 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 switchover 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.