github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/handle-an-exception/full-disk-lock.md (about) 1 --- 2 title: Full disk lock 3 description: How to configure disk lock when it is about to be full 4 sidebar_position: 2 5 sidebar_label: Full disk lock 6 --- 7 8 # Full disk lock 9 10 The full disk lock function of KubeBlocks ensures the stability and availability of a database. This function triggers a disk lock when the disk usage reaches a set threshold, thereby pausing write operations and only allowing read operations. Such a mechanism prevents a database from being affected by disk space exhaustion. 11 12 ## Lock/unlock mechanism 13 14 When the space water level of any configured volume exceeds the defined threshold, the instance is locked (read-only). Meanwhile, the system sends a related warning event, including the specific threshold and space usage information of each volume. 15 16 When the space water level of all configured volumes falls below the defined threshold, the instance is unlocked (read and write). Meanwhile, the system sends a related warning event, including the specific threshold and space usage information of each volume. 17 18 :::note 19 20 1. The full disk lock function currently supports global (ClusterDefinition) enabling or disabling and does not support Cluster dimension control. Dynamically enabling or disabling this function may affect the existing Cluster instances that use this ClusterDefinition and cause them to restart. Please operate with caution. 21 22 2. The full disk locking function relies on the read permission (get & list) of the two system resource nodes and nodes/stats. If you create an instance via kbcli, make sure to grant the controller administrative rights to the ClusterRoleBinding. 23 24 3. Supported engines for KubeBlocks v0.6.0: ApeCloud MySQL, PostgreSQL, MongoDB. 25 26 ::: 27 28 ## Enable full disk lock 29 30 - For MySQL database, the read/write user cannot write to the disk when the disk usage reaches the `highwatermark` value, while the superuser can still write. 31 - For PostgreSQL and MongoDB, both the read/write user and the superuser cannot write when the disk usage reaches `highwatermark`. 32 - `90` is the default value setting for the high watermark at the component level which means the disk is locked when the disk usage reaches 90%, while `85` is used for the volumes setting which overwrites the component's threshold value. 33 34 In the cluster definition, add the following content to enable the full disk lock function. You can set the value according to your need. 35 36 ```bash 37 volumeProtectionSpec: 38 highWatermark: 90 39 volumes: 40 - highWatermark: 85 41 name: data 42 ``` 43 44 :::note 45 46 The recommended value of `highWatermark` is 90. 47 48 ::: 49 50 ## Disable full disk lock 51 52 Delete `volumeProtectionSpec` from the cluster definition file.