This guide explains how to restore a new MySQL cluster from an existing backup in KubeBlocks. It showcases two methods: using Cluster Annotation or the Ops API.
The Ops API provides enhanced control and progress monitoring capabilities for restore operations, acting as a wrapper around the Cluster Annotation.
Prerequisites
KubeBlocks Environment:
KubeBlocks operator and required CRDs installed.
kubectl configured to access your Kubernetes cluster.
Existing Backup:
A valid backup named example-mysql-backup-backup in the 'demo' namespace.
Verify Backup Status
Before restoring, ensure that a full backup is available. The restoration process will use this backup to create a new MySQL cluster.
Run the following command to check the backup status:
Monitor the progress of the restoration operation:
kubectl get ops example-mysql-cluster-restore -n demo -w
Expected Output:
NAME TYPE CLUSTER STATUS PROGRESS AGE
example-mysql-cluster-restore Restore example-mysql-cluster-restored Running -/- 55s
example-mysql-cluster-restore Restore example-mysql-cluster-restored Succeed -/- 3m3s
Verify the Restored Cluster Status
After the restoration process is complete, verify the status of the newly restored cluster:
kubectl get cluster example-mysql-cluster-restored -n demo
Example Output:
NAME CLUSTER-DEFINITION TERMINATION-POLICY STATUS AGE
example-mysql-cluster-restored WipeOut Running 3m2s
Cleanup
To remove all created resources, delete the MySQL cluster along with its namespace:
This guide demonstrated how to restore a MySQL cluster from an existing backup using either the Cluster Annotation or Ops API. By following these steps, you can efficiently restore critical data to a new MySQL cluster in KubeBlocks.