When you restructure your network or move workloads between environments, you may need to move an ApsaraDB for MongoDB instance to a different virtual private cloud (VPC) or vSwitch without migrating your data. This topic describes how to switch the VPC and vSwitch of an instance.
Prerequisites
Before you begin, ensure that you have:
An instance that stores data on Enterprise SSDs (ESSDs)
Before you switch
Switching the VPC and vSwitch causes the following changes. Review them before you proceed, and schedule the switch during a low-traffic period to minimize the impact on your workloads.
| Change | Impact | Action required |
|---|---|---|
| Transient disconnection | The instance is briefly unavailable during the switch | Make sure your application reconnects automatically |
| VIP change | The virtual IP (VIP) of the instance changes | Use a high-availability connection string URI in your application instead of a hard-coded IP address |
| DMS and DTS unavailability | Data Management (DMS) and Data Transmission Service (DTS) cannot access the instance until the VIP change completes | Both services resume automatically; no action required. See What is DMS? and What is DTS? |
| DNS cache | The Domain Name System (DNS) cache on your client may cause read and write failures after the switch | Clear the DNS cache on your client promptly after the switch completes, then verify connectivity |
Switch the VPC and vSwitch
Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the region where the instance resides, then click the instance ID.
In the Basic Information section, click Change Virtual Private Cloud next to Network Type.
In the Change Virtual Private Cloud panel, select the target virtual private cloud and vSwitch.
Click OK.
After the switch completes, the instance connects to the new VPC and vSwitch. Clear the DNS cache on your client and verify that your application can connect to the instance.