This topic describes how to perform a manual or automatic switchover of services between a primary ApsaraDB RDS for MySQL instance and its secondary instance. After the switchover, the primary instance becomes the secondary 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.

Background information

  • Automatic switchover: the default switchover mode. If the primary instance becomes faulty, your services are automatically switched over to the secondary instance.
  • Manual switchover: allows you to manually switch over services between the primary and secondary instances. You can do so even if the automatic switchover function is enabled.
Note Data is synchronized in real time between the primary and secondary instances. You can access only the primary instance. The secondary instance serves only as a backup instance and does not allow external access.

For more information about how to perform the switchover in other database engines, see the following topics:

Precautions

  • During a switchover, a brief disconnection may occur. Make sure that your application is configured to automatically reconnect to the instance.
  • If the primary instance has read-only instances, data replication on the read-only instances shows a latency of a few minutes after a switchover. This is because it takes time to re-establish replication links and synchronize incremental data.

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

  1. Log on to the ApsaraDB for RDS console.
  2. In the left-side navigation pane, click Instances. In the top navigation bar, select the region where the target RDS instance resides.
    Select a region
  3. Find the target instance and click the instance ID.
  4. In the left-side navigation pane, click Service Availability.
  5. In the Availability Information section, click Switch Primary/Secondary Instance.
  6. Specify the Switching Time parameter and click OK.
    Note During the switchover, operations such as managing databases and accounts and changing network types cannot be performed. We recommend that you select Switch Within Maintenance Window.

Temporarily disable automatic switchover

The automatic switchover function is enabled by default. In this situation, services are automatically switched over to the secondary instance if the primary instance becomes faulty. You can disable the automatic switchover function in the following situations:

  • A sales promotion, during which you do not want a switchover to affect service availability.
  • An important application upgrade, during which you do not want a switchover to incur any unexpected issues.
  • A major event that requires stable system operation, during which you do not want a switchover to affect system stability.
  1. Log on to the ApsaraDB for RDS console.
  2. In the left-side navigation pane, click Instances. In the top navigation bar, select the region where the target RDS instance resides.
    Select a region
  3. Find the target instance and click the instance ID.
  4. In the left-side navigation pane, click Service Availability.
  5. In the Availability Information section, click Configure Primary/Secondary Instance.
    Note If the Configure Primary/Secondary Switchover button is not displayed, check whether the RDS instance runs the High-availability Edition.
  6. Select Disable Temporarily, specify Deadline, and click OK.
    Note
    • When the time specified by Deadline arrives, the automatic switchover function is restored to enabled for the RDS instance.
    • By default, the automatic switchover function is disabled for one day. You can specify the Deadline parameter to 23:59:59 seven days later at most.

After the setting is complete, you can go to the Service Availability page to check the deadline before which the automatic switchover function is disabled.

FAQ

Can I access a secondary instance?

No, you cannot access a secondary instance. You can access only a primary instance. A secondary instance serves only as a backup instance and does not allow external access.

Related operations

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