All Products
Search
Document Center

ApsaraDB for MongoDB:Change shard configurations

Last Updated:Aug 21, 2026

When a shard no longer meets your storage needs or encounters a performance bottleneck, you can change its instance specifications or storage capacity. ApsaraDB for MongoDB sharded cluster instances allow you to change configurations, such as instance specifications and storage capacity, for one or more shards.

Limitations

  • The selected storage capacity must be greater than or equal to the storage space the shard currently uses.

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

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

Billing rules

For more information, see Configuration change fees.

Precautions

  • When you change instance specifications, one or two transient disconnections may occur, each lasting about 30 seconds. You can schedule the switchover time to minimize the impact on your workloads.

    Important

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

    • For instances that use cloud disks, scaling up storage capacity does not affect your services. No transient disconnection occurs, and the change takes effect immediately.

    • For instances that use local disks, the system performs different operations based on whether the host has sufficient storage resources. If the host has sufficient resources, the storage is scaled up in-place without a cross-physical-machine migration or switchover. No transient disconnection occurs, and the change takes effect immediately. If the host has insufficient resources, a cross-physical-machine migration and switchover are required. A transient disconnection occurs, and the change takes effect during the switchover time that you specify.

  • The duration of a configuration change depends on several factors, such as network conditions, the task queue, and the amount of data. We recommend that you perform this operation during off-peak hours and ensure that your application has an automatic reconnection mechanism.

  • If your database runs an outdated minor version that is no longer maintained, the system automatically upgrades it to the latest version during the configuration change to ensure better performance and stability.

  • Local disk instance modifications take significantly longer than cloud disk modifications, which typically complete within one hour.

    Factors that affect the duration of a configuration change

    If the host physical server lacks sufficient resources, modifying a local disk instance triggers a cross-host migration, which significantly increases the duration. If the host has sufficient resources, the change is applied in place. The following table lists the key factors.

    Storage type

    Cross-host migration

    Influencing factor

    Description

    Local disk

    No

    Number of databases and collections

    Configuration changes restart the nodes. More databases and collections increase startup time. Regularly remove unused ones. Instance slowdowns or exceptions due to an excessive number of databases and collections.

    Ongoing index creation

    Configuration changes restart the nodes. In-progress index creation forces a rebuild, increasing startup time.

    Yes

    Total data size

    Total data size affects migration and synchronization time. Migration speed is limited by the network bandwidth of the instance type.

    Incremental data write rate

    Higher write rates increase the time for the new node to synchronize incremental data.

    Oplog retention period

    If the Oplog retention period is too short, incremental logs may be overwritten, causing synchronization failure. Ensure the retention period meets: Retention Period (hours) ≥ Used Data Space (GB) / 10 (GB/hour).

    Daily backup status

    Data can be migrated using backup sets if daily backups have minimal disk fragmentation and a sufficient Oplog retention period.

    Number of indexes

    More indexes increase the index creation time on the new node during synchronization.

    Number of databases and collections

    More databases and collections increase synchronization time on the new node.

    Cloud disk

    No

    -

    Cloud disk configuration changes use snapshots and complete quickly. The factors above do not apply.

    Note

    Use cloud disk instances for time-sensitive scenarios.

Procedure

  1. Go to the ApsaraDB for MongoDB sharded cluster instances page. In the top navigation bar, select a resource group and a region. Then, click the ID of the target instance.

  2. In the Shard List section, change the configurations of the desired shards.

    • Change configurations for 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 configuration. For a subscription instance, select Upgrade or Downgrade as needed.

    • Change configurations for multiple shards

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

      2. In the upper-left corner of the Shard List section, click Batch Reconfigure for pay-as-you-go instances. For subscription instances, click Batch Upgrade or Batch Downgrade as needed.

  3. Set the following parameters.

    Parameter

    Description

    Category

    Select the instance specification category for the shard.

    Note
    • Available only for cloud disk-based instances.

    • A category is unavailable if the current zone does not support it.

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

    Instance Specifications

    Select the instance specifications for the shard.

    Storage Capacity

    Select the new storage capacity for the shard.

    Note
    • The new storage capacity must be greater than or equal to the shard's current capacity. To decrease storage capacity, you must create a new instance. For more information, see Solutions for other configuration change scenarios.

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

    Read-only Nodes

    Select the number of read-only nodes after the configuration change.

    Switchover Time

    Select when the configuration change takes effect.

    • Switch Immediately after Migration: The change is applied as soon as the task completes.

    • Switch within Maintenance Window: The system applies the change within the specified maintenance window. You can use the current maintenance window or set a new one.

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

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

    Note

    If you only scale up the storage capacity and the host of each shard has sufficient resources, the storage is scaled up in-place without a cross-physical-machine migration or switchover. In this case, the change takes effect immediately, rather than waiting for the maintenance window.

  4. Complete the purchase based on your billing method.

    • For pay-as-you-go instances: Click Pay. The system automatically deducts the fee within the next hour.

    • For subscription instances: Click Pay, and then follow the instructions on the Pay page to complete the payment.

    During the configuration change, the instance status is In the process of matching. The change is complete when the instance status changes to Running.

Related APIs

API

Description

ModifyNodeSpec

Modifies the specifications of a single Mongos node or shard in an ApsaraDB for MongoDB sharded cluster instance.

ModifyNodeSpecBatch

Modifies the specifications of multiple Mongos nodes or shards in an ApsaraDB for MongoDB sharded cluster instance.