需要了解PD下的几个运维工具
pd-recover #用法不详
pd-ctl
./pd-ctl -u http://172.16.0.50:2379
登陆后输入help查看支持的命令
help
Placement Driver control
Usage:
[command]
Available Commands:
cluster show the cluster information
config tune pd configs
exit exit pdctl
health show all node's health information of the pd cluster
hot show the hotspot status of the cluster
label show the labels
log set log level
member show the pd member status
operator operator commands
ping show the total time spend ping the pd
region show the region status
scheduler scheduler commands
store show the store status
table_ns show the table namespace information
tso parse TSO to the system and logic time
输入 help config ##可获得参数的使用方法
tune pd configs
Usage:
config [command]
Available Commands:
delete delete the config option
set set the option with value
show show schedule config of PD
##
store #查看集群状态,等同于在IE输入地址查看
http://172.16.0.50:2379/pd/api/v1/stores
» store 52 ##查看单个TIKV服务状态
{
"store": {
"id": 52,
"address": "172.16.0.50:20160",
"state_name": "Up"
},
"status": {
"capacity": "12 KiB",
"leader_weight": 1,
"leader_score": 1,
"region_weight": 1,
"region_score": 1,
"start_ts": "2018-03-31T10:25:25+08:00",
"last_heartbeat_ts": "2018-03-31T10:42:18.09835485+08:00",
"uptime": "16m53.09835485s"
}
}
当集群出现duplicated store address时候,解决办法
store delete 1 #删除冲突编号,重新启动tikv即可
» store lable
store_id should be a number
» store weight
Usage: store weight
config
» config show ##显示PD负载设置
{
"max-snapshot-count": 3,
"max-pending-peer-count": 16,
"max-store-down-time": "1h0m0s",
"leader-schedule-limit": 64,
"region-schedule-limit": 12,
"replica-schedule-limit": 16,
"tolerant-size-ratio": 2.5,
"schedulers-v2": [
{
"type": "balance-region",
"args": null
},
{
"type": "balance-leader",
"args": null
},
{
"type": "hot-region",
"args": null
},
{
"type": "label",
"args": null
}
]
}
config set leader-schedule-interval 20s
member ##PD成员信息状态
member delete name pd名字
» member leader show ##显示主节点
member resign pd名字 #注册新PD
» member leader_priority tidb149 1
其他命令可以通过:命令 +help 查看用法
查看添加索引的任务
admin show ddl
admin show ddl jobs #查看当前DDL作业队列中所有的结果
show stats_healthy#查看表是否做优化
其他客户端工具操作类似!!!