Cluster Backup
As of version 1.3.0, the PolarDB-X Operator has rolled out support for full backup restore.This guide will walk you through the steps to perform a full backup of a PolarDB-X cluster.
Prerequisites
- Upgrade the PolarDB-X Operator to version 1.3.0 or higher.
- Complete the backup storage configuration, see documentation: Backup Storage Configuration.
Initiating a Full Backup
The following explains how to use the PolarDBXBackup object to execute a full backup for PolarDB-X.
Creating a PolarDBXBackup Object
- Write a pxc-backup.yaml file by following the example below:
apiVersion: polardbx.aliyun.com/v1 kind: PolarDBXBackup metadata: name: pxcbackup-test spec: cluster: name: polardbx-test retentionTime: 240h storageProvider: storageName: sftp sink: default preferredBackupRole: follower
Parameter description:
- cluster.name: The name of the target PolarDB-X cluster to be backed up
- retentionTime: The duration to retain the backup set, measured in hours
- storageProvider.storageName: The storage method for the backup set, supports sftp and oss
- storageProvider.sink: The name of the storage configuration for the backup set, corresponding to the name field in Backup Storage Configuration
- preferredBackupRole( this parameter is only applicable to version 1.4.0 and later ): The preferred role of the node to perform the backup, options include
follower
andleader
, with the default beingfollower
. Note that initiating a backup on theleader
node may affect the service, so configure with caution
2.Create the PolarDBXBackup object to trigger the full backup with the following command:
kubectl create -f pxc-backup.yaml
Viewing Full Backup Progress
Use the following command to view the progress of the full backup:
kubectl get pxb
Once the PHASE
in the progress changes to Finished
, the full backup is considered complete.
NAME CLUSTER START END RESTORE_TIME PHASE AGE
pxcbackup-test polardbx-test 2022-10-21T04:56:38Z 2022-10-21T04:58:21Z 2022-10-21T04:57:23Z Finished 4m15s
The RESTORE_TIME
field in the progress indicates the latest time point to which the backup set can restore.
Notes
- The metadata.name field in the PolarDBXBackup object refers to the name of the backup set, and must be changed for each new backup set creation.
Accessing Backup Sets
After the full backup is complete, the backup sets are located at the following path; you can view the corresponding backup set files in the SFTP configured host or OSS bucket.
{root_path}/polardbx-backup/{pxc_name}/{pxc_backup_name}-{timestamp}
- root_path depends on the storage configuration
- If sftp is used as storage, this value is sink.rootPath
- If oss is used as storage, this value is sink.bucket
- polardbx-backup is a fixed field
- pxc_name is the name of the cluster to be backed up
- pxc_backup_name is the name of the backup set
- timestamp is the backup start timestamp (UTC+0)