ApsaraDB MyBase for MySQL supports automatic switchovers, including primary/secondary
switchovers and master elections. In a cluster of High-availability Edition, if the
primary instance is down, the system automatically fails over to the secondary instance.
In a cluster of Master-replica Edition, if the master instance is down, the system
automatically elects a read-only instance to serve as the master instance. You can
also manually perform primary/secondary switchovers and master elections.
Background information
- Automatic switchover: By default, the automatic switchover feature is enabled for
clusters of High-availability Edition. If the primary instance is down, the system
automatically fails over to the secondary instance. After you enable automatic switchover
for one or more read-only instances in a cluster of Master-replica Edition, if the
master instance is down, the system automatically elects a read-only instance to serve
as the master instance.
Note You must enable the automatic switchover feature for at least one read-only instance
in a cluster of Master-replica Edition.
- Manual switchover: You can manually perform switchovers when automatic switchover
is enabled. You can perform manual switchovers for disaster recovery drills. You can
also perform manual switchovers if your cluster is deployed across zones and you want
to connect your application to an instance in the nearest zone.
Considerations
- Your application is disconnected when your ApsaraDB MyBase cluster performs a switchover.
Make sure that your application is configured to automatically reconnect to your cluster.
- After a switchover is complete, read-only instances require several minutes to re-establish
sessions and synchronize incremental data with the secondary instance or the new master
instance.
Perform a primary/secondary switchover
Note Only ApsaraDB MyBase for MySQL clusters of High-availability Edition support primary/secondary
switchovers.
- Log on to the ApsaraDB MyBase console.
- In the upper-left corner of the page, select the region where you want to create a
dedicated cluster.
- In the upper-left corner of the page, select a region.
- In the left-side navigation pane, click Instances. On the page that appears, find the instance that you want to manage and click Details in the Actions column.
- In the left-side navigation pane, click Service Availability.
- In the Availability Information section, click Switch Primary/Secondary Instance.
- Specify the point in time at which you want to perform the switchover and click OK.
Note During the primary/secondary switchover, you cannot perform operations such as database
management, account management, or network type changes. We recommend that you select
Switch Within Maintenance Window.
Perform a master election
Note Only ApsaraDB MyBase for MySQL clusters of Master-replica Edition support master elections.
- Log on to the ApsaraDB MyBase console.
- In the upper-left corner of the page, select the region where you want to create a
dedicated cluster.
- In the upper-left corner of the page, select a region.
- In the left-side navigation pane, click Instances. On the page that appears, find the instance that you want to manage and click Details in the Actions column.
- In the left-side navigation pane, click Service Availability.
- Move the pointer over the instance and click Switch Master/Slave.
Note We recommend that you select a read-only instance that bears low traffic loads or
has the same specifications as the master instance.

- Specify the point in time at which you want to perform the election and click OK.
Note During the election, you cannot perform operations such as database management, account
management, or network type changes. We recommend that you select Switch Within Maintenance Window.
Disable automatic switchover for a read-only instance
Note Only ApsaraDB MyBase for MySQL clusters of Master-replica Edition support master elections.
If a read-only instance bears high traffic loads or the specifications of the instance
are lower than those of the master instance, you can disable automatic switchover
for the read-only instance. This way, the read-only instance cannot be elected as
the master instance.
- Log on to the ApsaraDB MyBase console.
- In the upper-left corner of the page, select the region where you want to create a
dedicated cluster.
- In the upper-left corner of the page, select a region.
- In the left-side navigation pane, click Instances. On the page that appears, find the instance that you want to manage and click Details in the Actions column.
- In the left-side navigation pane, click Service Availability.
- Move the pointer over the instance and click Set Uncut.
Note After you disable automatic switchover for the read-only instance, the instance handles
only read requests and cannot be elected as the master instance.

- In the message that appears, click OK.