This topic describes how to manually or automatically switch over 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 primary instance runs the High-availability or Cluster Edition.

Note RDS instances running the Basic Edition do not have secondary instances, and therefore do not support service switchovers.

Background information

  • Automatic switchover: the default switchover mode. If the primary instance becomes faulty, your RDS 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 only access the primary instance. The secondary instance serves only as a backup instance and cannot be accessed.

Precautions

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

Manually switch over services between a primary instance and its secondary instance

  1. Log on to the ApsaraDB for RDS console.
  2. In the top navigation bar, select the region where the target primary instance resides.
  3. Find the target primary instance and click its 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.

    During the switchover, operations such as managing databases and accounts and changing network types cannot be performed. Therefore, we recommend that you select Switch Within Maintenance Window.

Temporarily disable automatic switchover

The automatic switchover function is enabled by default. In such case, services can be automatically switched over to the secondary instance if the primary instance becomes faulty. You can disable the automatic switchover function in one of 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 top navigation bar, select the region where the target primary instance resides.
  3. Find the target primary instance and click its ID.
  4. In the left-side navigation pane, click Service Availability.
  5. In the Availability Information section, click Configure Primary/Secondary Switchover.
    Note If the Configure Primary/Secondary Switchover button does not exist, make sure that the primary instance runs the High-availability Edition with standard or enhanced SSDs.
  6. Select Disable Temporarily, set Deadline, and click OK.
    Note The automatic switchover function is disabled for seven days 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.

Related operations

Operation Description
SwitchDBInstanceHA Switches over services between a primary ApsaraDB for RDS instance and its secondary instance.