Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 如何使用 命令 删除 tikv中某个key的数据
TiKV cluster version v5.0.1
Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 如何使用 命令 删除 tikv中某个key的数据
TiKV cluster version v5.0.1
The recommended approach is to write SQL to directly drop the database at the TiDB level, rather than touching the physical disk files of TiKV.
Look at the deployment topology file, directly rm -rf, stay calm and composed.
It depends on your needs. If you don’t need the cluster anymore, just delete the directory. If you still want the cluster and want to completely restore it, just clear the directories of TiKV and PD, and restart it. It will automatically reinitialize, and even the passwords will be gone.
Decode the primary key ID from the key value, and then delete from it.
Here is a link to an additional decoding method:
TiDB Specific Functions | PingCAP Documentation Center
Retrieving data through the key and then deleting the data by directly deleting the key is too risky.
You can backtrack through this link: 专栏 - tidb中的key和MVCC value解析 | TiDB 社区
Do not delete physical files, use SQL statements to delete.
There are clients in so many languages that can delete. There is always one that suits you.
If it doesn’t work, use Python to make one. Looking at the example, it only takes a few lines of code to write.
The TiKV client is divided into two, one is tikvclient and the other is rawclient. The tikvclient does not provide a delete API, while the rawclient does provide a delete API. However, I still haven’t figured out what the rawclient key is all about.
Please provide the Chinese text you would like translated into English.