Uninstalling TiDB

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb卸载

| username: cf_data

[TiDB Usage Environment] Testing
[TiDB Version] 7.4.0

Guys, I want to uninstall TiDB (7.4.0) installed on CentOS. I have already used the command: tiup cluster destroy tidb-test01 to destroy the cluster. Do I really need to delete the files one by one as shown in the screenshot? Is there any other method to delete them more thoroughly?

| username: 春风十里 | Original post link

It will be deleted after normal execution. Are you sure about this screenshot?

tiup cluster destroy | PingCAP Documentation Center
After the business goes offline, if you want to release the machines occupied by the cluster for other business use, you need to clean up the data on the cluster and the deployed binary files. The tiup cluster destroy command will perform the following operations to destroy the cluster:

  • Stop the cluster
  • For each service, delete its log directory, deployment directory, and data directory
  • If the parent directory of each service’s data directory/deployment directory was created by tiup-cluster, it will also be deleted
| username: zhanggame1 | Original post link

Uninstalling the cluster does not require deleting files; they are automatically deleted. .tiup is unrelated to the cluster, and if you don’t need it, you can remove it with rm.

| username: CuteRay | Original post link

It is recommended not to be misled by such articles. To uninstall the TiDB cluster, just use tiup cluster destroy.
TiUP Common Maintenance Operations | PingCAP Documentation Center

| username: 随缘天空 | Original post link

Why not use the uninstall command to uninstall?

| username: 小龙虾爱大龙虾 | Original post link

Because this only removes the component itself, tools like ctl can be uninstalled this way. However, for components like cluster, which have the functionality to create a TiDB cluster, the cluster should also be deleted using the commands within the cluster component.

| username: 随缘天空 | Original post link

I haven’t tried it, so I’m not sure. I feel that the download command should also remove all the cluster installations, deployments, and data directories.

| username: ShawnYan | Original post link

The official documentation is very comprehensive. I don’t recommend reading external articles. If you encounter any confusion with the official documentation, you can always post questions.

| username: cf_data | Original post link

I think so too, just worried about residual files.

| username: cf_data | Original post link

Okay, thank you.

| username: cf_data | Original post link

Okay, I will look into it further, thank you.

| username: andone | Original post link

The command tiup cluster destroy will automatically delete the folder. There won’t be any residual files.

| username: tidb菜鸟一只 | Original post link

Destroy means deleting the log directory, deployment directory, and data directory for each service.

| username: zxgaa | Original post link

The cluster destruction seems very thorough, no additional rm is needed.

| username: 舞动梦灵 | Original post link

I used these two commands to uninstall. After the first command, the directory and data were still there. After executing the second command, all the data was gone, leaving only the empty installation directory. Then, I could directly install and deploy new versions.

| username: TIDB-Learner | Original post link

My personal suggestion is to follow the official uninstall command. If you are worried about residual files, you can use the find command to search for them and manually remove them with rm. Many software systems leave residual files in the system after uninstallation. In Linux, everything is a file, so just delete them.

| username: zhanggame1 | Original post link

Clean is not uninstalling; it is deleting all data and initializing the cluster.

| username: zhanggame1 | Original post link

To completely delete the cluster, you need to use destroy. You can check some parameters here:
tiup cluster destroy | PingCAP Documentation Center

| username: Kongdom | Original post link

I have destroyed it before, and I remember it deletes everything, so there’s no need to execute rm separately. :yum:

| username: 普罗米修斯 | Original post link

You can use destroy. The directories on the path have been completely deleted after the test cluster was used.