TiDB is a database with high availability. Data is stored and replicated on TiKV, the storage layer of TiDB, which can tolerate the inavailability of nodes. TiKV uses local storage with high IOPS and high throughput, such as Local SSDs, to enhance database capacity.
Kubernetes currently supports statically allocated local storage. To create a local storage object, use the
local-volume-provisioner program in local-static-provisioner project. The procedures are as follows:
Pre-allocate local storage in TiKV cluster nodes. See the operation document provided by Kubernetes for reference.
local-volume-provisioner program. See the Helm installation procedure for reference.
By default, when a local PV is released, the provisioner recycles it. To prevent data from being recycled automatically, you must set the reclaim policy of your storage class to
Retain. After confirming that a PV’s data can be deleted, modify its reclaim policy to
Delete. For how to change PV reclaim policy in Kubernetes, refer to this doc.
Refer to Best Practices for more information with local PV in Kubernetes.