Database backup and restore are critical functionalities to ensure data security and business continuity. By regularly backing up databases, it is possible to quickly recover data in the event of data loss, corruption, or inadvertent operations, thereby minimizing business interruptions and data loss.
Prior to backup, please prepare an external S3 compatible storage based on the volume of business data.
Create S3 secret
Add automatic backup configuration information in the spec of the mysqlschedules resource.
Parameter | Description |
---|---|
expiryDays | Retention period for backup data |
full.cron | Cron expression for full backup |
incr.cron | Cron expression for incremental backup |
storage.s3.bucket | Bucket name |
storage.s3.endpoint | S3 storage endpoint |
storage.s3.region | S3 storage region |
storage.s3.secret.name | S3 storage secret name |
Ensure the instance status is Running
Create a data backup
Parameter | Description |
---|---|
backup_name | Backup resource name |
namespace | The namespace where the instance to be backed up resides |
instance_name | The name of the instance to be backed up |
storage.s3.bucket | Bucket name |
storage.s3.endpoint | S3 storage endpoint |
storage.s3.region | S3 storage region |
storage.s3.secret.name | S3 storage secret name |
type | Backup type: full or increment |
Wait for the backup to complete and check the backup status
Create MySQLRestore to restore data
Parameter | Description |
---|---|
restore_name | Restore resource name |
namespace | The namespace where the instance to be restored resides |
backup_name | The full backup resource name to be used |
target_instance_name | The name of the instance to restore data to |
source_instance_name | The instance name from which the backup resource is sourced |
Wait for the restore to complete and check the restore status