github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/kubeblocks-for-mysql/cluster-management/delete-mysql-cluster.md (about) 1 --- 2 title: Delete a MySQL Cluster 3 description: How to delete a MySQL Cluster 4 keywords: [mysql, delete a cluster] 5 sidebar_position: 7 6 sidebar_label: Delete protection 7 --- 8 9 import Tabs from '@theme/Tabs'; 10 import TabItem from '@theme/TabItem'; 11 12 # Delete a MySQL Cluster 13 14 ## Termination policy 15 16 :::note 17 18 The termination policy determines how you delete a cluster. 19 20 ::: 21 22 | **terminationPolicy** | **Deleting Operation** | 23 |:----------------------|:-------------------------------------------------| 24 | `DoNotTerminate` | `DoNotTerminate` blocks delete operation. | 25 | `Halt` | `Halt` deletes workload resources such as statefulset, deployment workloads but keep PVCs. | 26 | `Delete` | `Delete` deletes workload resources and PVCs but keep backups. | 27 | `WipeOut` | `WipeOut` deletes workload resources, PVCs and all relevant resources included backups. | 28 29 To check the termination policy, execute the following command. 30 31 <Tabs> 32 33 <TabItem value="kbcli" label="kbcli" default> 34 35 ```bash 36 kbcli cluster list mysql-cluster 37 > 38 NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME 39 mysql-cluster default apecloud-mysql ac-mysql-8.0.30 Delete Running Feb 06,2023 18:27 UTC+0800 40 ``` 41 42 </TabItem> 43 44 <TabItem value="kubectl" label="kubectl"> 45 46 ```bash 47 kubectl -n demo get cluster mysql-cluster 48 > 49 NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE 50 mysql-cluster apecloud-mysql ac-mysql-8.0.30 Delete Running 67m 51 ``` 52 53 </TabItem> 54 55 </Tabs> 56 57 ## Step 58 59 Run the command below to delete a specified cluster. 60 61 <Tabs> 62 63 <TabItem value="kbcli" label="kbcli" default> 64 65 ```bash 66 kbcli cluster delete mysql-cluster 67 ``` 68 69 </TabItem> 70 71 <TabItem value="kubectl" label="kubectl"> 72 73 If you want to delete a cluster and its all related resources, you can modify the termination policy to `WipeOut`, then delete the cluster. 74 75 ```bash 76 kubectl patch -n demo cluster mysql-cluster -p '{"spec":{"terminationPolicy":"WipeOut"}}' --type="merge" 77 78 kubectl delete -n demo cluster mysql-cluster 79 ``` 80 81 </TabItem> 82 83 </Tabs>