This topic describes how to perform a primary/secondary switchover for an instance that spans three availability zones and resolve primary zone misalignment issues.
Create a three-zone instance
When you create a PolarDB-X instance, you can set the Deployment Topology to Three-Zone Deployment or Single Zone. Select Three-Zone Deployment to create an instance deployed across three availability zones. For more information, see Create an instance.
View availability zone information
After creating an instance, you can view its availability zone information on pages related to the instance.
Instance list page
On the instance list page, the "Availability Zone" column displays the details of the primary and secondary zones for multi-zone instances.
For example, for a multi-AZ instance, the Availability Zone column displays the primary and secondary availability zones in the format 'Availability Zone (G+H)'.
Instance details page
On the Basic Information page of an instance, the availability zone information is the same as on the Instance List page and includes details for both the primary and secondary zones.
Instance topology page
On the instance topology page, you can view the availability zone and status of each node.
In the navigation pane on the left, click Basic Information. Then, scroll to the Topology information section to view the zone distribution of nodes. For example, compute nodes might have a
masternode incn-hangzhou-gand astandbynode incn-hangzhou-h. Data nodes and metadata nodes might have aleaderincn-hangzhou-g, afollowerincn-hangzhou-h, and aloggerincn-hangzhou-i. All log nodes might be located incn-hangzhou-g. To switch the primary zone, click the Specify Primary Zone button in the upper-right corner.
Specify the primary zone
-
Log on to the PolarDB-X console.
-
In the top navigation bar, select the region where the instance is deployed.
-
On the Instances page, click the PolarDB-X 2.0 tab.
-
Find the instance that you want to manage and click its ID.
On the Basic Information page, go to the Topology Information section and click the Specify Primary Zone button.
In the Specify Primary Zone dialog box, select the availability zone that you want to set as the new primary zone, and then click OK.
ImportantA primary/secondary zone switchover causes transient connections, so we recommend performing this operation during off-peak hours.
In the Specify primary zone dialog box, select the target availability zone from the Primary zone drop-down list. Set Switchover mode to Switch immediately or Switch within maintenance window, and then click OK.
After the instance status briefly changes to HA Switching, the switchover between the primary and secondary availability zones is complete.
FAQ
Q: After creating an instance that spans three availability zones, I noticed that some compute nodes are inactive and have the
standbyrole. What is the purpose of these nodes in a three-zone disaster recovery setup?
A: An instance that spans three availability zones has a defined primary zone. The system aligns the compute and storage nodes with this primary zone whenever possible. The
masterrole signifies a compute node in the primary zone, while thestandbyrole signifies a node in a secondary zone. In the event of a zone-level failure, you can quickly switch over to the secondary zone, allowing the standby compute nodes to take over the workload. On the Basic Information page of the instance, in the Topology Information section, click Specify Primary Zone. In the Specify Primary Zone dialog box, select the current primary zone ID (in other words, do not change the primary zone), and click OK. This action changes the role of compute nodes in the former secondary zone fromstandbytomaster.Q: Due to their built-in high availability (HA) capabilities, data nodes can sometimes become misaligned. This means the primary zone of a data node group might not match the primary zone of the instance. In the data node list within the Topology information section, if the values in the Leader AZ column are inconsistent (for example, one is
cn-hangzhou-hand another iscn-hangzhou-g), this indicates a misalignment, which you can correct with the Specify Primary Zone feature.A: On the Basic Information page of the instance, in the Topology Information section, click the Specify Primary Zone button. In the Primary Zone drop-down list, select the current primary zone ID (in other words, do not change the primary zone) and click OK. The instance status temporarily changes to HA Switching. When the process is complete, the system aligns all data nodes and metadata services with the primary zone.
ImportantThis realignment process causes transient connections, so we recommend performing this operation during off-peak hours.