English | 简体中文
- Install NFS server and resources
- Obtain
nfsServerAddress
- Create an NFS backup
- Restore the cluster from the NFS backup
helm install demo charts/mysql-operator --set nfsBackup.installServer=true --set nfsBackup.volume.createLocalPV=true
Or manually create the PVC and run:
helm install demo charts/mysql-operator --set nfsBackup.installServer=true --set nfsBackup.volume.specifiedPVC=XXXX
XXX
stands for the PVC name.
In this way, you can install the Pod and Service of the NFS server in the cluster while installing the operator.
kubectl apply -f config/samples/nfs_pv.yaml
kubectl apply -f config/samples/nfs_server.yaml
For example:
kubectl get svc nfs-server --template={{.spec.clusterIP}}
10.96.253.82
You can use ClusterIp
to perform NFS backup. The cluster IP address in the example is 10.96.253.82
.
# config/samples/mysql_v1beta1_backup.yaml
nfsServerAddress: "10.96.253.82"
kubectl apply -f config/samples/mysql_v1beta1_backup.yaml
Note: The backup CRD and MySQL cluster CRD must be in the same namespace.
View the backup directory <cluster name>_<timestamp>
as follows.
kubectl exec -it <pod name of nfs server> -- ls /exports
index.html initbackup sample_2022419101946
Configure the nfsServerAddress
attribute to the NFS server address in the mysql_v1alpha1_cluster.yaml
file or mysql_v1beta1_cluster.yaml
file.
...
restoreFrom: "sample_2022419101946"
nfsServerAddress: 10.96.253.82
Notice:
restoreFrom
stands for the path name of the backup. You can get it by checking the path loaded by the NFS server.
Restore cluster from NFS backup as follows.
kubectl apply -f config/samples/mysql_v1alpha1_cluster.yaml