Switch the primary zone
This topic describes how to switch the primary zone in the ApsaraDB for OceanBase console.
Concepts
In ApsaraDB for OceanBase, the data replicas of the same partition are distributed to multiple zones. The zone where the leader of the partitions resides is called the primary zone.
Scenarios
When the primary zone fails, ApsaraDB for OceanBase will automatically switch the leader to a new zone to ensure service availability.
If you want to perform a drill for the high availability feature, you can manually switch the primary zone in the ApsaraDB for OceanBase console. Generally, we recommend that you do not manually switch the primary zone.
Considerations
To ensure the primary zone access performance, make sure that the primary zone and the primary endpoint proxy are in the same zone after the drill.
After you change the primary zone of a tenant, the primary zone of the primary endpoint proxy cluster will not be automatically updated.
If the deployment mode of the proxy cluster has never been switched, the deployment mode is displayed as to be switched on the proxy page. In this case, you can change the primary zone of the primary endpoint proxy on the page for changing the primary zone of the tenant.
If the deployment mode of the proxy cluster has been switched, the primary zone of the proxy endpoint keeps consistent with that of the proxy cluster. In this case, you need to choose Database Proxy > Change Configuration and change the primary zone of the proxy cluster to that of the tenant to reduce the latency between IDCs. For more information, see Manage the database proxy service.
Procedure
Log in to the ApsaraDB for OceanBase console.
In the left-side navigation pane, click Instances.
On the Instances page, click the name of the target instance to go to the instance workspace.
For a serverless instance, click Switch Primary Zone in the Deployment Diagram section. For a cluster instance, go to the Tenant Management page and click the target tenant in the tenant list to go to the Tenant Workspace page. Then, click the More icon in the upper-right corner and select Switch Primary Zone.
Switching the primary zone of the primary endpoint proxy may interrupt services for about 30s. We recommend that you perform this operation in off-peak hours. Automatic reconnection is supported for business applications.
If you switch the zone where the primary endpoint proxy resides, the virtual IP address will be changed. Therefore, use an endpoint for your application instead of an IP address.
The database becomes temporarily unavailable due to the change of the virtual IP address. Refresh and obtain the updated connection information in the ApsaraDB for OceanBase console.
The change of the virtual IP address also affects the use of tools such as OceanBase Developer Center (ODC) and OceanBase Migration Service (OMS). Make sure that the latest virtual IP address is used for the connection of the tools.
In the dialog box that appears, set the related parameters.

Parameter
Description
Primary Zone
Select one or more zones.
Connect Proxy Of Primary Zone
Select the new zone for the primary endpoint proxy. You cannot select a zone with a read-only endpoint.
NoteIf the zone for the primary endpoint proxy and the data primary zone are different, data latency exists.
When a direct connection address is used, selecting multiple zones can increase the access latency of the direct connection address. We recommend that you use a primary endpoint or access address instead of a direct connection address.
VPC
Select the VPC.
NoteIf you modify the VPC or vSwitch of a connection address, services will be interrupted for about 30s during the switching process. We recommend that you perform the operation in off-peak hours and ensure that the application supports reconnection.
Access vSwitch through primary address
Select the vSwitch to bind.
Click OK.