All Products
Search
Document Center

ApsaraDB for MongoDB:Change shard configurations

Last Updated:Apr 11, 2026

If a shard has insufficient storage or a performance bottleneck, you can change its specifications or storage capacity.ApsaraDB for MongoDB sharded cluster instances let you change these configurations for one or more shards.

Limitations

  • The selected storage capacity must be greater than or equal to the shard's current storage usage.

  • The selected number of read-only nodes must be greater than or equal to the maximum number of read-only nodes among all shards in the instance.

  • You cannot increase the number of read-only nodes when you downgrade a subscription instance.

Billing

For more information, see Configuration change fees.

Usage notes

  • When you change specifications, one or two transient disconnections may occur, each lasting about 30 seconds. You can schedule the change to take effect at a specific time to avoid service interruptions.

    Important

    When you change only the storage capacity, the impact of the scale-out operation varies between instances that use cloud disks and instances that use local disks.

    • Instances that use cloud disks: Scaling out storage capacity does not affect your services. No transient disconnection occurs, and the task is executed and takes effect immediately.

    • Instances that use local disks: The system's behavior depends on whether the host has sufficient storage resources. If resources are sufficient, the storage is scaled out on the local host without a cross-host migration or switchover. No transient disconnection occurs, and the change takes effect immediately. If resources are insufficient, a cross-host migration and switchover are required. A transient disconnection occurs, and the switchover takes effect within the specified maintenance window.

  • The time required to complete a configuration change depends on several factors, including network conditions, the task queue, and the amount of data. Perform configuration changes during off-peak hours and ensure your application has an automatic reconnection mechanism.

  • If the minor version of your database is outdated or no longer maintained, the system, by default, upgrades it to the latest version to ensure better performance and stability.

  • Configuration changes for instances that use local disks take longer than for instances that use cloud disks. For cloud disk instances, the change typically completes within one hour, making them suitable for time-sensitive scenarios.

    Factors that affect the duration of a configuration change

    For an instance that uses local disks, if the host resources are insufficient for the new configuration, a cross-host migration is triggered, which increases the duration of the change. If the host has sufficient resources, the configuration is changed in place. The following table describes the key factors that affect the duration of the change.

    Storage type

    Cross-host migration

    Influencing factor

    Description

    Local disk

    No

    Number of databases and collections

    A configuration change restarts the node. The number of databases and collections affects the node startup time. To minimize startup time, regularly delete unused databases and collections. For more information, see Instance becomes slow or abnormal due to too many databases and collections.

    Ongoing index creation

    A configuration change restarts the node. If an index is being created, it must be rebuilt after the restart, which increases the node startup time.

    Yes

    Total data size

    The total data size affects the data migration and synchronization time. The migration speed is also limited by the network bandwidth of the instance type.

    Incremental data write speed

    The write speed of incremental data affects the duration of the incremental data synchronization process for the new node.

    oplog retention period

    If the oplog retention period is too short, incremental logs can be overwritten, causing synchronization to the new node to fail. To ensure a sufficient synchronization window, make sure the retention period meets the following requirement: Retention period (h) ≥ Used data space (GB) / 10 (GB/h).

    Daily backup status

    In some scenarios, migration can be performed by using backup sets, provided that daily backups do not have significant disk fragmentation and the oplog retention period is long.

    Number of indexes

    The number of indexes affects the time it takes for the new node to synchronize and create indexes.

    Number of databases and collections

    The number of databases and collections affects the time it takes for the new node to synchronize them.

    Cloud disk

    No

    -

    Configuration changes for instances that use cloud disks use cloud disk snapshots. This significantly reduces the duration of the change, so you do not need to consider other factors.

    Note

    Use instances with a cloud disk architecture for time-sensitive scenarios.

Procedure

  1. Go to the Sharded Cluster Instances page. At the top of the page, select a resource group and region, and then click the ID of the target instance.

  2. In the Shard List section, change the configuration of one or more shards as needed.

    • To change the configuration of a single shard

      In the row of the target shard, click the 三个点 icon in the Actions column. For a pay-as-you-go instance, select Change Configurations. For a subscription instance, select Upgrade or Downgrade as needed.

    • To change the configurations of multiple shards

      1. In the Shard List section, select the target shards.

      2. In the upper-left corner of the Shard List section, select Batch Change Configurations for a pay-as-you-go instance. For a subscription instance, select Batch Upgrade or Batch Downgrade as needed.

  3. Set the following parameters.

    Parameter

    Description

    Category

    Select a category for the shard.

    Note
    • This parameter is available only for instances that use cloud disks.

    • If an instance category is not supported in the current availability zone, you cannot select it.

    • For information about the instance categories and specifications of sharded cluster instances, see Sharded cluster instance types.

    Instance Specifications

    Select the specifications for the shard.

    Storage Capacity

    Select the new storage capacity for the shard.

    Note
    • The selected storage capacity must be greater than or equal to the current storage capacity of the shard. To reduce storage capacity, create a new instance and migrate data to it. For more information, see Other configuration change scenarios and solutions.

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

    Read-only Nodes

    Select the number of read-only nodes.

    Switchover Time

    Select when the configuration change takes effect.

    • Switch Immediately after Migration: The system applies the configuration change immediately after the task is complete.

    • Switch within Maintenance Window: The configuration change takes effect within the specified maintenance window. You can use the current maintenance window or configure a new one based on your business requirements.

      1. Click Edit next to Switch within Maintenance Window to set the switchover time.

      2. In the Specification Information section, click Edit next to Maintenance Period to set the switchover time. For more information, see Set a maintenance window.

    Note

    If you only scale up the storage capacity and the hosts where the shards reside have sufficient resources, the storage is scaled out on the local hosts. No cross-host migration or switchover is required. In this case, the task is executed and takes effect immediately, not within the maintenance window.

  4. Complete the purchase based on the billing method.

    • Pay-as-you-go: Click Go to Pay. The system automatically deducts the fee in the next hour.

    • Subscription: Click Go to Pay and follow the instructions on the Payment page to complete the payment.

    While the configuration change is in progress, the instance status is Modifying. The change is successful when the status changes to Running.

API reference

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