reference
- https://docs.pingcap.com/zh/tidb-in-kubernetes/stable/backup-restore-cr
- https://github.com/pingcap/tidb-operator/blob/master/pkg/apis/pingcap/v1alpha1/types.go#L1912
- https://asktug.com/t/topic/1042360
introduction
prepare
- optional: only for local storage
- requirements
- for backup/restore by br,
local://
protocol requires a local path in tikv to store the backup/restore files - therefore, we need to create a pvc to mount the local path in tikv
- for backup/restore by br,
- prepare
backup.pvc.yaml
-
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: tidb-cluster-backup-pvc namespace: tidb-cluster spec: accessModes: - ReadWriteMany resources: requests: storage: 20Gi storageClassName: ""
- apply to the cluster
-
kubectl -n tidb-cluster apply -f backup.pvc.yaml
-
-
- patch the tidb cluster
-
kubectl -n tidb-cluster patch tidbcluster basic --type=merge -p '{"spec":{"tikv":{"additionalVolumes":[{"name":"backup","persistentVolumeClaim":{"claimName":"tidb-cluster-backup-pvc"}}],"additionalVolumeMounts":[{"name":"backup","mountPath":"/backup"}]}}}'
- check and waiting for the cluster status to be ready
-
kubectl -n tidb-cluster get tidbcluster basic -w
-
-
About 1 min