1.检查schedul-limit参数
show config where type='pd' and name like '%schedule-limit';
schedule.hot-region-schedule-limit 4
schedule.leader-schedule-limit 4
schedule.merge-schedule-limit 8
schedule.region-schedule-limit 2048
schedule.replica-schedule-limit 64
show config where type='pd' and name like '%enable-cross-table-merge';
schedule.enable-cross-table-merge true (允许region跨表合并,一个region中包含多个表)
show config where type='tikv' and name like '%split-region-on-table';
coprocessor.split-region-on-table false(不允许region按table分裂成多个)
coprocessor.split-region-on-table false
coprocessor.split-region-on-table false
split-region-on-table需要配合enable-cross-table-merge使用
show config where type='pd' and name like '%schedule.split-merge-interval';
schedule.split-merge-interval 2h0m0s
2.检查region数目
select store_id,leader_count,region_count from INFORMATION_SCHEMA.TIKV_STORE_STATUS;
1 0 5
4 3 5
5 2 5
3.修改参数
coprocessor.split-region-on-tableg改成true
schedule.enable-cross-table-merge 改成false
schedule.split-merge-interval 改成1m0s 1分钟合并一次
这样修改后一个region中只含有一个表,region数目会变多
set config tikv `coprocessor.split-region-on-tableg`=true;
set config pd `schedule.enable-cross-table-merge`=false;
set config pd `schedule.split-merge-interval`='1m0s';
tiup cluster editconfig tidbtest
coprocessor.split-region-on-table: true
重启tikv
tiup cluster reload tidbtest -R tikv
4.检查region数目
select store_id,leader_count,region_count from INFORMATION_SCHEMA.TIKV_STORE_STATUS;
1 12 30
4 6 30
5 12 30
region 15个增加到90个
leader 5个增加到30个
5.空region合并
以上操作导致很多空region,现在恢复原样。
set config tikv `coprocessor.split-region-on-tableg`=false;
set config pd `schedule.enable-cross-table-merge`=true;
set config pd `schedule.split-merge-interval`='1m0s';
tiup cluster editconfig tidbtest
coprocessor.split-region-on-table: true
重启tikv
tiup cluster reload tidbtest -R tikv
检查region数目
select store_id,leader_count,region_count from INFORMATION_SCHEMA.TIKV_STORE_STATUS;
1 2 5
4 0 5
5 3 5
恢复原样,空region已合并