This topic describes how to upgrade the MongoDB version of an instance in the ApsaraDB for MongoDB console. ApsaraDB for MongoDB supports MongoDB 4.4, 4.2, 4.0, and 3.4.
For more information about the MongoDB versions supported by ApsaraDB for MongoDB, see Versions and storage engines.
MongoDB versions for upgrade
|Instance architecture||Before upgrade||After upgrade||Description|
|Standalone instance||3.4 and 4.0||N/A||Upgrade to MongoDB 4.0 is not supported. If you need an ApsaraDB for MongoDB instance with MongoDB 4.0, select the version when you create the instance. For more information, see Create a standalone instance.|
|Replica set instance||3.2 (retired), 3.4, 4.0, 4.2, and 4.4||3.4, 4.0, and 4.2||Upgrade to MongoDB 4.4 is not supported. If you need an ApsaraDB for MongoDB instance with MongoDB 4.4, select the version when you create the instance. For more information, see Create a replica set instance.|
|Sharded cluster instance||3.2 (phased-out), 3.4, 4.0, and 4.2||3.4, 4.0, and 4.2||N/A|
- The duration of upgrading the MongoDB version of an instance is related to the data volume of databases in this instance. We recommend that you schedule your upgrade task during off-peak hours.
- You cannot downgrade the MongoDB version of an instance after you upgrade it.
- Nodes in an instance are upgraded in turn. An instance is automatically restarted two or three times during an upgrade. We recommend that you perform the upgrade during off-peak hours or make sure that your application is configured to connect to the instance after it is disconnected.
Note If your application runs in a production environment, we recommend that you use a connection string URI to connect your application to the instance. This way, the read and write operations of your application remain available even if a node fails as a result of a primary/secondary switchover. For more information, see Overview of replica set instance connections or Overview of sharded cluster instance connections.
- The balancer of a sharded cluster instance is disabled during an upgrade and is enabled after the upgrade.
- Log on to the ApsaraDB for MongoDB console.
- In the upper-left corner of the page, select the resource group and the region of the target instance.
- In the left-side navigation pane, click Replica Set Instances, or Sharded Cluster Instances based on the instance type.
- Find the target instance and click its ID.
- On the Basic Information page, click Upgrade Database Version and select the version for upgrade.
- In the Upgrade Database Version message, click OK.
The instance status changes to Upgrading. When the instance is changed to the Running state, the upgrade is complete.