Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tikv集群扩容,有什么参数可以加速region平衡迁移速度的?
【TiDB Usage Environment】Production Environment
【TiDB Version】5.3.0
【Encountered Problem: Phenomenon and Impact】
Background:
The old TiKV server has disk issues and is planned to be smoothly replaced, so a new node is added to replace the old node.
Configuration and Current Status of New and Old Machines
The original TiKV had three nodes, each with 1.4 million regions. The newly expanded node has a configuration of 16c/32g. Currently, during the balancing process, the CPU usage of the new node is only 7%, while the CPU usage of the old TiKV nodes is 50%. At the current speed, it is estimated to take 37 days to complete the balancing.
Questions
- Are there any parameters that can speed up region balancing? The cluster is idle at night, so this parameter can be increased at night and decreased during the day.
- Additionally, if the cluster performance degrades significantly during the balancing process, can region migration be paused?
You can view the PD scheduling configuration by executing the following query:
select * from INFORMATION_SCHEMA.CLUSTER_CONFIG t
where t.`KEY` like '%schedule-limit%'
Increase the default values of leader-schedule-limit
(default is 4) and region-schedule-limit
(default is 2048).
Modification commands:
set config pd `schedule.leader-schedule-limit`=8;
set config pd `schedule.region-schedule-limit`=4096;
config set max-pending-peer-count 16
config set replica-schedule-limit 64
The main ones are these three:
leader-schedule-limit
region-schedule-limit
store limit
The specific values depend on your configuration.
Thank you all for completing the balance in 20 hours. Here are some pictures:
Old node offline
20 hours? The data volume doesn’t seem particularly large. However, it’s best to use acceleration parameters during off-peak business hours.
This is the final region balance diagram.
There is one thing I don’t understand: the new node has a 3TB disk, while the old node has a 2TB disk.
Why does the new machine have more regions than the old machine? Shouldn’t they be balanced equally?
That’s correct. Previously, with 3 nodes and 3 replicas, each node had 2TB, so the total data volume was 2TB multiplied by 3, which is 6TB. Now, with 2 nodes and 3 replicas, the total data volume remains the same, but the number of nodes has decreased. So, 6TB divided by 2 means each node now has 3TB.
Each store node has a Region score, and PD will balance the regions of each node based on this Region score.