课程名称:2.5.3 Usage of PD control(PD Control 的典型使用场景)
学习时长:45min
课程收获:使用 pd-ctl 工具,查看集群信息,调度策略,调度参数配置
课程内容:
-
Placement Driver的概览
-
PD Control 使用场景
-
在PD不能按照预期做调度时,通过PD Control制定调度策略
-
启动方式
- tiup ctl pd -u http://<pd_ip>:<pd_port> [-i]
- tidb-ansible /resources/bin/pd-ctl -u http://<pd_ip>:<pd_port> [-i]
-
有用的参数
- –detach, -d:单命令模式(默认)
- –interfact, -i:交互模式
- –pd, -u:生命PD地址(默认 http://127.0.0.1:2379)
-
从进程获取pd信息
- bin/tidb-server … --path=xxxx:2379,yyyy:2379,zzzz:2379
- bin/tikv-server … --pd xxxx:2379,yyyy:2379,zzzz:2379
- tiup cluster display <cluster_name>
-
-
查看及修改pd config
-
启动pd ctl后子命令
- cluster
- member
- member leader show
- health
- tso xxxxxxxxxxxxxxx
-
修改pd member
- member leader resign
- member leader transfer <pd_name>
- member leader_priority <pd_name>
- member delete name <pd_name>
- member delete id <pd_id>
-
kv cluster info
-
store
-
region
-
region <region_id>
-
region store <store_id>
-
List store label (DC/Zone/Rack/Host) info
- label
- label store dc <dc_name>
-
-
modify kv member
- store weight <store_id> <leader_weight> <region_weight>
- store label 1
- store delete <store_id>
-
Scheduler Config
-
调度速度
- .leader-schedule-limit
- …
- tolerant-size-ratio
-
Region Merge Limit
- max-merge-region-keys
- max-merge-region-size
-
Rebalance Timer
- max-store-down-time
-
-
修改Scheduler Config
-
config set
-
与Region Merge有关的修改
- config set region-schedule-limit
- …
-
-
查看及控制Scheduling Operation
-
显示operators
- opertator show
- operator show admin/leader/Region
-
对一个store上某个Region增加或删除副本
- operator add add-peer <region_id> <store_id>
- operator add remove-peer <region_id> <store_id>
-
将某个Region的leader调度到某个store
- operator add transfer-leader <region_id> <store_id>
-
…
-
-
Store Limit Config
- store limit
-
Set Store Limit
-