Backup Schedule

As of version 1.4.0, the PolarDB-X Operator has rolled out support for full backup scheduling.This guide will walk you through the steps to configure backup scheduling for PolarDB-X.

Notes

  • If a backup is scheduled but there is another backup currently in progress for the specified PolarDB-X cluster, the scheduled backup will only start after the ongoing backup has completed.
  • If multiple schedules are initiated simultaneously, ensure to craft your scheduling rules thoughtfully to avoid triggering multiple backups at the same time.

Creating a Backup Schedule

An example of a PolarDBXBackupSchedule object is as follows:

apiVersion: polardbx.aliyun.com/v1
kind: PolarDBXBackupSchedule
metadata:
  name: pxc-schedule
spec:
  schedule: "*/20 * * * *"
  maxBackupCount: 5
  suspend: false
  backupSpec:
    cluster:
      name: polardbx-test
    retentionTime: 240h
    storageProvider:
      storageName: sftp
      sink: default
    preferredBackupRole: follower

Parameter Explanation:

  • schedule: The scheduling rule, meaning the regular time points to initiate backups, must be specified using a valid cron expression.
  • maxBackupCount: The upper limit on the number of backup sets retained. If the number of backups exceeds this limit, cleaning will start with the oldest backup set. The default value is 0, which means no cleanup is performed.
  • suspend: Whether the scheduling is suspended. The default is false, which means not suspended
  • backupSpec: Backup configuration, refer to Cluster Backup

To create a backup schedule, write a pxc-schedule.yaml file following the example above and apply it with the following command:

kubectl apply -f pxc-schedule.yaml

The scheduling status can be observed with the following command:

kubectl get pbs

You can obtain information from the status such as:

NAME           SCHEDULE       LAST_BACKUP_TIME       NEXT_BACKUP_TIME       LAST_BACKUP
pxc-schedule   */20 * * * *   2023-03-16T08:00:00Z   2023-03-16T08:20:00Z   polardbx-test-backup-202303160800

Examples of Scheduling Rules

The spec.schedule field of the PolarDBXBackupSchedule object denotes the scheduling rules that follow the standard cron expression format. Below are some examples of scheduling rules:

Scheduling Rule Meaning of the Rule
/20 * Initiate a backup every 20 minutes
0 Initiate a backup every hour
0 0 1 Initiate a backup at midnight every Monday
0 2 1,4 Initiate a backup at 2 a.m. on Monday and Thursday
0 2 /2 * Initiate a backup at 2 a.m. every other day

results matching ""

    No results matching ""