如何删除offline状态tikv

【 TiDB 使用环境】生产环境
【 TiDB 版本】 v5.3.1 3副本
【复现路径】做过哪些操作出现的问题
误操作强制缩容了1个kv节点, tiup scale-in tidb -N 172.16.61.21:20160 --force -y
然后又扩容了1个kv节点, 目前集群状态正常
【遇到的问题:问题现象及影响】
用tiup看集群信息已经无缩容节点, 用pd-ctl stores 获取缩容节点信息 状态是offline,region count 120 。

缩容后数据目录已经不存在,用什么方法删除这个节点
{
“store”: {
“id”: 4,
“address”: “172.16.61.21:20160”,
“state”: 1,
“version”: “5.3.1”,
“status_address”: “172.16.61.21:20180”,
“git_hash”: “ecc2549ed63fc21f1f6e11f1b85f19c2465234a5”,
“start_timestamp”: 1690773632,
“deploy_path”: “/opt/tidb-deploy/tikv-20160/bin”,
“last_heartbeat”: 1690773644351448028,
“state_name”: “Offline”
},
“status”: {
“capacity”: “0B”,
“available”: “0B”,
“used_size”: “0B”,
“leader_count”: 0,
“leader_weight”: 1,
“leader_score”: 0,
“leader_size”: 0,
“region_count”: 120,
“region_weight”: 1,
“region_score”: 1048,
“region_size”: 1048,
“slow_score”: 0,
“start_ts”: “2023-07-31T11:20:32+08:00”,
“last_heartbeat_ts”: “2023-07-31T11:20:44.351448028+08:00”,
“uptime”: “12.351448028s”
}
}

PD-CTL 终端中执行 remove <store_id>

pd v5.3.1 没有这个命令 pd-ctl store delete <store_id>只能把tikv变成offline状态
Usage:
pd-ctl [command]

Available Commands:
cluster show the cluster information
completion Output shell completion code for the specified shell (bash)
config tune pd configs
exit exit pdctl
health show all node’s health information of the pd cluster
help Help about any command
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
plugin plugin commands
region show the region status
scheduler scheduler commands
service-gc-safepoint show all service gc safepoint
store manipulate or query stores
tso parse TSO to the system and logic time
unsafe Unsafe operations

unsafe remove-failed-stores 101

用remove

送你一个小工具,先把store上的region都清理掉,再执行store remove-tombstone
clear_tikv_regions.html (7.7 KB)

3 个赞
1 个赞

问题解决

此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。