When the data volume or read/write traffic grows, you can increase the number of shards for your Tair (Redis OSS-compatible) cluster instance to improve its overall performance. After you change the configuration, the instance automatically rebalances the data. No manual operations are required.
Background information
Cloud-native clusters and classic clusters have different management architectures. Therefore, the procedure to adjust the number of shards is different for each cluster type.
Item | Cloud-native cluster | Classic cluster |
Overview of the upgrade/downgrade procedure | You can flexibly adjust the number of shards. The scaling process is seamless. This means no transient connections or read-only states occur during scale-out or scale-in operations. The following steps are performed by the system in the background.
| The instance must be fully migrated to a new instance. Therefore, you can also adjust the shard specifications at the same time. The following steps are performed by the system in the background.
|
Impact | Minor impact. The time required to complete the configuration change depends on multiple factors, such as the network, task queue, instance payload, and data volume. Because the operation may cause fluctuations in response latency, perform the operation during off-peak hours. |
|
Costs
Pay-as-you-go instances: After you add or remove shards, the instance is billed based on the new specifications.
Subscription instances: If you add shards, you must pay for the new shards. If you remove shards, you will receive an automatic refund. For more information about costs and the refund policy, see Configuration change fees.
Adjust the number of shards for a cluster instance
Cloud-native cluster
Notes
Operations are executed immediately in all scenarios. However, for proxy mode instances, you can choose to remove shards within a maintenance window. After you adjust the number of shards, the instance status immediately changes to Adjusting configuration.
An instance must have at least 2 shards. You can add or remove up to 64 shards in a single operation. An instance can have a maximum of 256 shards.
When you add shards, the instance automatically rebalances data. However, if you add too few shards at a time, the rebalancing speed and scale-out efficiency are low. We recommend that you add at least 1/6 of the current total number of shards in a single operation (rounded up). For example:
If the current instance has 8 shards, add at least 2 shards (8/6 = 1.33, rounded up to 2).
If the current instance has 64 shards, add at least 11 shards.
If the current instance has 100 shards, add at least 17 shards.
Procedure
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.
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 and click Pay. Then, complete the payment.
NoteThe specifications of the new shards must be the same as those of the existing shards.
Remove shards
WarningRemoving shards reduces the total capacity and performance of the instance and forcibly disconnects connections to the corresponding shards. Perform this operation with caution. If you must perform this operation, make sure that your application has a reconnection mechanism.
Click Delete Shard in the upper-right corner of the Shard Information section or click Delete in the Actions column corresponding to the shard.
If the instance is in proxy mode, you must also select a deletion policy for the proxy nodes. We recommend that you select Update During Maintenance.
Click OK. The shard is then removed, and its data is automatically migrated to other shards.
Classic cluster
Notes
If direct connection is enabled for the instance, you cannot change the number of shards and the shard specifications at the same time. For more information, see Configuration change solutions for classic cluster instances.
Procedure
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.
For a subscription instance, in the upper-right corner, choose or Specification Downgrade. For a pay-as-you-go instance, in the upper-right corner, choose .
On the configuration change page, select the desired configuration and click Buy Now.
ImportantWe recommend that you perform the adjustment within the maintenance window. Before the task is executed, you can go to the Task Center page from the navigation pane on the left of the console, find the task for the instance, and change its execution time.
Complete the payment.
What to do next
After you submit the configuration change request, the instance status immediately changes to Changing Configuration. This change does not affect the services that are provided by the instance. You can view the task status on the Task Center page.
FAQ
Q: If I add or remove shards from an instance, is the data redistributed?
A: Yes, it is. When the number of shards in an instance changes, the instance automatically rebalances the data.
For cloud-native instances, the data rebalancing process is highly optimized at the kernel layer. This allows for fast rebalancing with minimal impact on your services.
For classic instances, the instance switch occurs only after the data is rebalanced on the new instance.
Q: If I remove a shard, is the data lost?
A: No, it is not. The data is redistributed.
Q: If I remove a shard, do I get a refund?
A: Yes, you do. You will receive an automatic refund. For more information about costs and the refund policy, see Configuration change fees.
Q: Can I convert a classic cluster instance to a cloud-native cluster instance?
A: Yes, you can. For more information, see Switch to the cloud-native deployment mode.
Related API operations
API operation | Description |
Adds a shard to a cloud-native cluster instance. | |
Removes a shard from a cloud-native cluster instance. | |
Adds or removes shards for a classic cluster instance. |
References
To change shard specifications, see Change instance configurations.