This topic describes how to upgrade the database version of an ApsaraDB for MongoDB instance in the ApsaraDB for MongoDB console. ApsaraDB for MongoDB now supports 3.2, 3.4, 4.0, and 4.2.

Database versions

For more information about the versions supported by ApsaraDB for MongoDB, see Versions and storage engines.

Target versions for upgrade

Instance Supported version Target version Description
Standalone instances 3.4 and 4.0

N/A

Upgrade to 4.0 is not supported. If you need an ApsaraDB for MongoDB instance with 4.0, select the version while you create the instance. For more information, see Create a standalone instance.
Replica set instances 3.2 (phased-out), 3.4, 4.0, and 4.2 3.4, 4.0, and 4.2 N/A
Sharded cluster instances 3.2 (phased-out), 3.4, 4.0, and 4.2 3.4, 4.0, and 4.2 N/A
Note For more information about the features in each version, see MongoDB versions and advantages.

Precautions

  • The time to upgrade the database version of an ApsaraDB for MongoDB 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 an instance after you upgrade it.

Impacts

  • 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. In this way, the read/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.

Procedure

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the upper-left corner of the page, select the resource group and the region of the target instance.
  3. Find the target instance and click its ID.
  4. In the left-side navigation pane, click Replica Set Instances or Sharded Cluster Instances based on the instance type.
  5. On the Basic Information page, click Upgrade Database Version and select the target version.
  6. In the Upgrade Database Version message that appears, click OK.

    The instance status changes to Upgrading. When the instance enters the Running state, the upgrade is complete.