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

Prerequisites

The master instance is in the High-availability or Enterprise Edition.

Note
  • RDS instances in the Basic Edition do not have slave instances, and therefore do not support service switchovers.
  • Only RDS instances in the High-availability Edition allow you to temporarily disable the automatic switchover function.

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.

Manually switch over services between the master and slave instances

  1. Log on to the RDS console.
  2. In the upper-left corner, select the region where the target RDS instance is located.

    选择地域
  3. Find the target RDS 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 the time at which you want to perform a switchover, and click OK.
    Note During the switchover, you cannot perform operations such as managing databases and accounts and changing the network type. 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, for example, a national holiday, during which you do not want a switchover to affect system stability.
  1. Log on to the RDS console.
  2. In the upper-left corner, select the region where the target RDS instance is located.

    选择地域
  3. Find the target RDS 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.


查看临时关闭状态