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

Prerequisites

The master instance is in the High-availability Edition.
Note RDS instances in the Basic Edition do not have slave instances, and therefore do not support service switchovers.

Background information

  • Automatic switchover: the default switchover mode. When the master instance becomes faulty, your RDS services are automatically switched over to the slave instance.
  • Manual switchover: You can manually switch over services between the master and slave instances even when the automatic switchover function is enabled.
Note

In the High-availability edition, an RDS instance (referred to as the master instance) has a slave instance. Data is synchronized in real time between the master and slave instances. You can only access the master instance. The slave instance is used only as a backup and does not provide services. After a service switchover, the master instance is degraded to the slave instance.

Precautions

  • Services may be disconnected during a switchover. Make sure that you configure automatic reconnection policies for your applications to avoid loss of services.
  • If read-only RDS instances are mounted to your RDS instance, the data in the read-only RDS instances shows a few minutes' delay after a switchover. This is because it takes time to reestablish replication links and synchronize incremental data.

Procedure

  1. Log on to the ApsaraDB for RDS console.
  2. In the upper-left corner of the page, select the region where the instance is located.选择地域
  3. Find the 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. Select an appropriate time to perform the switch, and click OK.

    During the switch, operations such as managing the databases and accounts and switchover the 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 slave instance if the master 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 upper-left corner of the page, select the region where the instance is located.选择地域
  3. Find the 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 Switchover.
    Note If the Configure Primary/Secondary Switchover button is unavailable, make sure that the RDS instance is in the High-availability Edition.
    主备库切换设置
  6. Select Disable Temporarily, set Deadline, and click OK.
    Note
    • When the specified 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 set the Deadline parameter to 23:59:59 seven days later at tops.
    临时关闭截止时间

After the setting is complete, you can go to the Service Availability page to check the deadline for disabling the automatic switchover function.

APIs

Operation Description
SwitchDBInstanceHA Switches between the master and slave instances.