Release a mongos or shard node

更新时间:
复制 MD 格式

To save costs, release mongos or shard nodes during off-peak hours or when the number of shard nodes exceeds your business requirements.

Considerations

  • While a node is being released, the sharded cluster instance enters the Deleting Node state. During this period, you cannot reset the password, perform a role switchover, change node connection strings, or modify parameters for the instance. Perform this operation during off-peak hours.

  • Ensure that your applications no longer use the node you want to release.

  • You cannot release a mongos node if the instance has only two mongos nodes.

  • When you release a shard node:

    • Before you release a shard node, ensure that the MongoDB balancer is enabled. For more information, see Manage the MongoDB balancer.

    • Factors such as the amount of data on the node, the balancing window, and jumbo chunks affect the time required to release a shard node.

      Note

      For more information about the balancing window and jumbo chunks, see balancing window and jumbo chunk.

    • Ensure that the remaining shard nodes have sufficient storage space.

      During the release, data on the target shard node is migrated to the remaining shard nodes. If the remaining nodes run out of storage space, the system automatically locks the instance to prevent data loss.

    • If a duplicated key error occurs during data migration from the shard node being released, check for documents that have the same value for a unique index field.

      For example, two documents with different shard keys but the same primary key might exist on different shard nodes.

      Note

      Orphaned documents in the database are a common cause of duplicated key errors. Clean up orphaned documents before you release a shard node. For more information, see Clean up orphaned documents.

Billing

For more information, see Configuration change fees.

Procedure

  1. Log on to the ApsaraDB for MongoDB console.

  2. In the navigation pane on the left, click Sharded Cluster Instances.

  3. In the upper-left corner of the page, select the resource group and region of the instance.

  4. Click the ID of the target instance, or click Manage in the Actions column.

  5. Select an option based on the type of node to release.

    • Release a mongos node

      In the Mongos List section, find the target mongos node, click the 更多 icon in the Actions column, and then select Release.

    • Release a shard node

      Important

      Ensure that the remaining shard nodes have sufficient storage space.

      During the release process, data from the target shard node is migrated to the remaining shard nodes. If the storage space on the remaining nodes becomes full, the system automatically locks the instance to prevent data loss.

      In the Shard List section, find the target shard node, click the 更多 icon in the Actions column, and then select Release.

  6. In the Release Node dialog box, click Confirm.

    During the release process, the instance status changes to Deleting Node.