Change the shard count of a cluster instance

更新时间:
复制 MD 格式

When your data volume or read/write traffic increases, you can scale out a cluster instance by adding shards.

Before you begin

  • Confirm the cluster deployment mode: The configuration change process, business impact, and limitations are completely different for Cloud-native and Classic clusters. Before you begin, log on to the console and confirm the deployment mode of your instance on the Basic Information page.

  • Choose off-peak hours: Changing the configuration of a cloud-native cluster may cause response latency fluctuations, and changing the configuration of a classic cluster will cause transient disconnections. To avoid affecting your business, we recommend that you perform the operation during off-peak hours.

  • Understand the billing changes:

    • Pay-as-you-go instances: After you add or remove shards, you are billed based on the new specifications.

    • Subscription instances: Adding shards incurs additional charges. Removing shards triggers an automatic refund. For more information about billing and refunds, see Billing for configuration changes.

Procedure

Cloud-native cluster

You can add or remove shards directly on the existing instance. The system automatically rebalances the data.

Impact

  • Adding shards: This is a seamless scale-out that does not cause transient disconnections or enter a read-only state.

  • Deleting shards: Deleting shards forcibly closes connections on the shards being removed. This may cause a partial transient disconnection. Ensure that your application has a reconnection mechanism.

  • Latency fluctuations: Response latency may fluctuate during the operation.

Limitations

  • The operation runs immediately, except when you delete shards from a proxy-mode instance. For that scenario, you can select Update During Maintenance. After you submit the task, the instance status changes to Changing Configuration.

  • An instance must have a minimum of 2 shards and a maximum of 256 shards. You can add or remove up to 64 shards in a single operation.

Procedure

  1. Log on to the console and go to the Instances page. In the top navigation bar, select the region in which the instance that you want to manage resides. Then, find the instance and click the instance ID.

  2. On the Instance Information page, in the Shard Information section, perform one of the following operations:

    • Add shards

      Click Add Shard. In the dialog box that appears, set the number of shards to add, and then click Pay.

      Note
      • The specifications of new shards must be the same as the existing shards.

      • To ensure efficient data rebalancing when you add shards, we recommend that you add at least 1/6 of the current total number of shards (rounded up) in a single operation. For example:

        • If the instance has 8 shards, we recommend that you add at least 2 shards (8/6 ≈ 1.33, rounded up to 2).

        • If the instance has 64 shards, we recommend that you add at least 11 shards.

    • Delete shards

      Warning

      Deleting shards reduces the total capacity and performance of the instance. Proceed with caution.

      1. Click Batch Delete or click Delete in the Actions column of the target shard.

      2. In the confirmation dialog box, click Determine. The system immediately deletes the shard and migrates its data to the remaining shards.

Classic cluster

The system creates a new instance with the new number of shards, migrates all data from the original instance to the new one, and then switches connections to the new instance at a specified time.

Impact

  • Transient disconnection: During the instance switchover, the instance experiences one or two transient disconnections, each lasting less than 30 seconds. Ensure that your application has a reconnection mechanism.

  • Read-only state: The instance typically enters a read-only state for less than one minute. In high-write scenarios, the duration of the read-only state may be longer.

  • Minor version upgrade: During the configuration change, the system upgrades the minor version of the instance to the latest version.

Limitations

You cannot change the number of shards if your instance has a direct connection endpoint enabled. For more information, see Solutions to change the configuration of a classic cluster instance.

Procedure

  1. Log on to the console and go to the Instances page. In the top navigation bar, select the region in which the instance that you want to manage resides. Then, find the instance and click the instance ID.

  2. In the upper-right corner of the instance details page, click Change Configuration. From the drop-down list, select one of the following options:

    • For a subscription instance, select Upgrade or Downgrade.

    • For a pay-as-you-go instance, select Upgrade or Downgrade.

  3. On the configuration change page, change the Number of Shards and click Buy Now.

    Important

    For the Switch Time setting, select a maintenance window to minimize service impact. You can reschedule the task in the Task Center at any time before it runs.

  4. Complete the payment process as prompted.

Verify the result

After you submit the configuration change task, the instance status changes to Changing Configuration. You can track the task progress on the Task Center page in the console. After the task is complete, return to the instance details page and verify that the Shard Information section shows the updated number of shards.

FAQ

  • Q: Is data redistributed when I add or remove shards?

    A: Yes. When the number of shards changes, the system automatically rebalances the data across all shards.

  • Q: Is data lost when a shard is deleted?

    A: No. The system automatically migrates data from the deleted shard to the remaining shards.

  • Q: Will I receive a refund if I delete a shard?

    A: For subscription instances, you will receive an automatic refund for the cost difference. For more information, see Billing for configuration changes.

  • Q: Can a Classic instance be converted to a Cloud-native instance?

    A: Yes. After the conversion, you can benefit from an improved management experience, such as seamless scaling. For more information, see Convert to the cloud-native deployment mode.