PolarDB for MySQL Enterprise Edition clusters support switching the default VPC and vSwitch online while the zone and the cluster endpoint remain unchanged.
If your ECS instance and PolarDB cluster are not in the same VPC, you cannot connect to the cluster over the Private. To resolve this, you can switch the VPC of the PolarDB cluster to match the VPC of the ECS instance. This establishes a Private connection and ensures that the PolarDB cluster delivers optimal performance.
Prerequisites
Your cluster must meet the following requirements:
-
Database Edition is Enterprise Edition and Edition is Cluster Edition.
-
The billing method is subscription or pay-as-you-go.
Considerations
-
During the VPC and vSwitch switchover:
-
This operation causes a
transient connection interruptionthat lasts about 30 seconds. We recommend performing this operation during off-peak hours and ensuring your application has a reconnection mechanism to prevent service disruptions. -
DNS resolution caching issues may cause database connection interruptions until the cache expires. After the switch is complete, we recommend that you restart your application or flush the DNS cache on the host where the application runs.
-
The switch briefly affects
Data Management Service (DMS)andData Transmission Service (DTS). These services automatically resume normal operation after the switch is complete.
-
-
When switching the VPC and vSwitch, you can choose whether to switch existing endpoints.
-
If you set Existing Endpoint Switching to No, only the default VPC and default vSwitch of the cluster are changed. The VPCs and vSwitches of existing endpoints are not changed.
-
If you set Existing Endpoint Switching to Yes, the default VPC and default vSwitch of the cluster are changed, and the VPCs and vSwitches of all existing endpoints are also changed.
NoteWhen you create a new
custom endpoint, it defaults to using the new default VPC and vSwitch. -
Change the default VPC and vSwitch of a cluster
-
Log on to the PolarDB console. In the left-side navigation pane, click Clusters. Select the region where your cluster is located, and then click the ID of the target cluster.
-
On the Basic Information page, click Switch next to Default VPC. In the Switch VPC dialog box that appears, select the target VPC and vSwitch.
ImportantIf you do not switch existing endpoints, their VPC and vSwitch will remain unchanged.
Change the VPC and vSwitch for a custom endpoint
Primary address and Cluster Endpoint do not support switching the VPC and vSwitch independently.
-
Log on to the PolarDB console. In the left-side navigation pane, click Clusters. Select the region where your cluster is located, and then click the ID of the target cluster.
-
In the Database Connections section, select the target custom endpoint. In the Modify Endpoint Settings dialog box, click More > Edit.
-
In the Modify Private Endpoint dialog box that appears, select the target VPC and vSwitch.
Click OK. Changing the VPC and vSwitch causes one or two
transient connection interruptions within a 30-second window. We recommend that you perform this operation during off-peak hours. If SSL is enabled for the endpoint, the change restarts the cluster. Additionally, the modified endpoint cannot exceed 64 characters.
Specify the VPC and vSwitch when you create a custom endpoint
-
Log on to the PolarDB console. In the left-side navigation pane, click Clusters. Select the region where your cluster is located, and then click the ID of the target cluster.
-
In the Database Connections section, click Create Custom Cluster Endpoint. In the Create Custom Cluster Endpoint dialog box, select the target VPC and vSwitch.
ImportantBy default, a new custom endpoint uses the cluster's default VPC and vSwitch. If you select a different VPC and vSwitch, creating the custom endpoint also changes the cluster's default settings to match your new selection.