All Products
Search
Document Center

ApsaraDB for MongoDB:Change shard configurations

Last Updated:Mar 28, 2026

When a shard runs low on storage or hits a performance bottleneck, scale its specifications or storage space. ApsaraDB for MongoDB sharded cluster instances let you apply configuration changes to one or more shards in a single operation.

Prerequisites

Before you begin, make sure that:

  • The new storage space is greater than or equal to the storage space currently used by each target shard

  • The number of read-only nodes selected is greater than or equal to the maximum number of read-only nodes across all target shards

  • For subscription instances being downgraded: you cannot increase the number of read-only nodes during a downgrade

Billing

For pricing details, see Configuration change fees.

How configuration changes work

The system behavior during a configuration change depends on your storage class and available host resources.

Storage-only changes (cloud disk or local disk)

If you change only the storage space, the system checks available resources on the local host:

  • Sufficient resources: Storage scales out locally. No migration or switchover occurs, no transient disconnection happens, and the change takes effect immediately without waiting for a maintenance window.

  • Insufficient resources: A cross-host migration and switchover are required. A transient disconnection occurs, and the change takes effect within the effective time you set.

Specification changes

Storage classCross-physical machine migrationKey factors affecting duration
Local diskNoNumber of databases/collections; whether an index rebuild is in progress (affects node restart time)
Local diskYesFull data size; incremental data write speed; oplog retention period; number of indexes; number of databases/collections; daily backup status
Cloud diskNoNone — changes are based on cloud disk snapshots and typically complete within one hour

For local disk instances with cross-physical machine migration, the oplog retention period must satisfy: Retention period (hours) ≥ Used data space (GB) / 10 (GB/h). If the retention period is too short, incremental logs may be overwritten and the new node may fail to synchronize.

Use cloud disk instances for scenarios that require short configuration change durations.

Usage notes

  • During a configuration change, one or two transient disconnections may occur. Each lasts about 30 seconds. Set the effective time to minimize impact on your application, and make sure your application has an automatic reconnection mechanism.

  • Schedule configuration changes during off-peak hours. The time to complete a change depends on network conditions, the task queue, and data size.

  • If your database minor version is expired or no longer maintained, the system automatically upgrades it to the latest version during the configuration change.

  • After you change the Storage Capacity of a shard, the new storage capacity applies to all nodes in the shard, including read-only nodes.

  • To decrease storage space, create a new instance instead. See Other configuration change scenarios and solutions.

Change shard configurations

  1. Go to the MongoDB sharded cluster instances page. Select a resource group and a region, then click the target instance ID.

  2. In the Shard List section, select the shards to reconfigure.

    • Single shard: Click the More actions icon in the Actions column of the target shard. Then select Change Configuration (pay-as-you-go) or Upgrade Configuration / Downgrade Configuration (subscription).

    • Multiple shards: Select the target shards. In the upper-left corner of the Shard List, select Batch Change Configurations (pay-as-you-go) or Batch Upgrade / Batch Downgrade (subscription).

  3. Set the parameters.

    ParameterDescription
    Specification CategoryThe specification category of the shard. Applies to cloud disk instances only. Categories not supported in the current zone are unavailable. For available categories, see Sharded cluster instance types.
    Instance SpecificationsThe compute specifications for the shard.
    Storage CapacityThe new storage space for the shard. Must be greater than or equal to the storage space currently used by the shard. The value applies to all nodes in the shard, including read-only nodes.
    Read-only NodesThe number of read-only nodes after the change.
    Switchover TimeWhen the configuration change takes effect: Switch Immediately after Migration applies the change as soon as migration completes. Switch within Maintenance Window defers the switchover to your maintenance window — click Edit next to Switch within Maintenance Window, then set the window in the Specification Information section. See Set a maintenance window. If you only scale out storage and the host has sufficient resources, the change takes effect immediately regardless of the switchover time setting.
  4. Complete the payment.

    • Pay-as-you-go: Click Pay Now. The fee is deducted automatically within the next hour.

    • Subscription: Click Pay Now and complete the payment on the Payment page.

  5. Monitor the instance status. The status changes to Changing Configuration during the process and returns to Running when the change is complete.

API reference

APIDescription
ModifyNodeSpecChanges the configuration of a single Mongos or shard node in a sharded cluster instance.
ModifyNodeSpecBatchChanges the configurations of multiple Mongos or shard nodes in a sharded cluster instance.