Tair (Redis OSS-compatible) cloud-native cluster instances allow you to adjust the number of shards to handle sudden spikes in database traffic. These instances also support imperceptible scaling, during which the instances continue to handle both read and write operations without transient connections. After the number of shards in a cluster instance is increased or decreased, the instance evenly redistributes data across available shards to ensure data consistency. You can use this feature to flexibly handle reads and writes on hot data and data skew issues.
Prerequisites
The instance uses the cluster architecture.
The instance is deployed in cloud-native mode.
Billing
If you change the number of shards for a pay-as-you-go instance, you are charged based on the new specifications after the change. In this case, no upfront payment is required. You only need to make a payment upon receiving the bill.
If you add shards to a subscription instance, you must pay for the cost of the additional shards. If you remove shards, a refund for the removed shards is automatically issued. For information about the fees and refund policy, see Configuration changes.
Impacts
You cannot add or remove shards during the maintenance window. After you adjust the number of shards for an instance, the status of the instance changes to Changing Configuration.
The time required to complete a configuration change depends on factors such as the network conditions, task queue length, instance load, and data volume. The configuration change may cause fluctuations in response latency. We recommend that you perform the operation during off-peak hours.
After you remove shards from a cluster instance, the total storage capacity and performance of the instance decrease, and your application is disconnected from the shards. Proceed with caution. To perform this operation, make sure that the application can automatically reconnect to the instance.
Precautions
An instance can contain 2 to 256 data shards. You can add or remove up to 64 data shards at a time.
When you add shards to an instance, the instance automatically redistributes data across all shards. However, if only a few shards are added at a time, it can lead to slow data redistribution and lower scale-out efficiency. We recommend that you add at least 1/6 of the current total number of shards (rounded up) to an instance at a time. Examples:
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.
If the instance has 100 shards, we recommend that you 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 the following operations based on your business requirements:
Add shards
Click Add Shard. In the panel that appears, specify the number of shards. Click Pay and complete the payment.
NoteThe specifications of the shards to be added are the same as those of existing shards and cannot be modified.
Remove shards
WarningAfter you remove shards from a cluster instance, the total storage capacity and performance of the instance decrease, and your application is disconnected from the shards. Proceed with caution. To perform this operation, make sure that the application can automatically reconnect to the instance.
Find the shard that you want to remove and click Delete in the Actions column. You can also click Delete Shard to batch remove shards.
FAQ
Does data loss occur if I remove shards from a cluster instance?
If you remove shards from a cluster instance, data is not lost. The data is redistributed across available shards.
Is a refund issued if I remove shards from a cluster instance?
If you remove shards from a cluster instance, a refund is automatically issued. For information about the fees and refund policy, see Configuration changes.
Is data redistributed after I increase or decrease the number of shards in a cluster instance?
After the number of shards in a cluster instance changes, Tair (Redis OSS-compatible) analyzes the distribution of data in the instance and evenly redistributes data across the shards. Tair (Redis OSS-compatible) is deeply optimized for data redistribution at the engine layer to accelerate redistribution and reduce business impacts.
Related API operations
API operation | Description |
Adds shards to a cluster instance. | |
Removes shards from a cluster instance. |
References
Redis Open-Source Edition automatically adds shards based on the average memory usage of an instance to ensure business security and stability. For more information, see Automatic shard addition.
For information about how to adjust the number of shards for classic cluster instances, see Change the configurations of an instance.