For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

Cennso Database Backup

A Cennso Database Backup is represented by the DBBackup Custom Resource (CR) and defines a job to back up MySQL instances managed by the Cennso Database Operator.

Important

To make a backup of your databases, you must first set the spec.backup.enabled parameter of the DBInstance Custom Resource to true. For more information, see the Deploy Cennso Database document.

The sections below provide information about configuration parameters that you can specify in the DBBackup CR. For more information on how to make a backup and restore from it, see the Back up and restore document.

Configuration restrictions

The values configured in the DBBackup Custom Resource have the following restrictions:

  • The DBBackup claim name must match the DBInstance claim name for the database instance you want to back up.
  • spec.namespace must match the Kubernetes namespace where the database instance is deployed.
  • The MySQL cluster must run at least one read replica. The backup job runs against a replica instead of the primary, so the target DBInstance must have spec.mysql.size set to 2 or more. If the cluster runs only a single instance, the backup job cannot find a pod to back up and fails with the error: ERROR: No read replica found. Backup can be performed only on a read replica..
  • The following parameters must not contain single quote (') characters:
    • spec.resticRepository
    • spec.additionalResticOpts.cacheDir
    • spec.additionalResticOpts.initExtraArgs
    • spec.additionalResticOpts.pruneExtraArgs
    • spec.additionalResticOpts.backupExtraArgs
    • spec.xtradbExtraArgs
  • The backup directory specified by spec.backupDirectory must be a subdirectory under /backup or /var/lib/mysql/backup. Empty path segments, . path segments, and .. path segments are not allowed.

Kubernetes cluster secret reference

To deploy the Cennso Database Backup to a Core Cluster, you must specify a reference to the Kubernetes secretOpens in a new tab so the cluster is accessible. You can do this using the following configuration parameters:

yaml

Set spec.connectionSecretRef.name to the name of the Core Cluster where the Cennso Database Backup should be installed. The spec.connectionSecretRef.namespace configuration parameter defines the Kubernetes Namespace on the Management Cluster where the Kubernetes secret to access this Core Cluster is stored. The spec.connectionSecretRef.key is an optional configuration parameter that defines the key in the Kubernetes secret which contains the kubeconfig for the Core Cluster. Its value defaults to kubeconfig.

Image configuration

You can use the following configuration parameters to specify the container image for the backup jobs, along with the secret to pull it:

yaml

The backup job container runs kubectl to start the backup inside the XtraBackup sidecar of a MySQL instance. The spec.image.registry configuration parameter is the full repository of the image, and spec.image.tag is its tag. The image must provide kubectl compatible with the Core Cluster.

Backup jobs placement

The backup jobs specified by the Cennso Database Backup CR are deployed in the Kubernetes namespace specified by the following configuration option:

yaml

Backup jobs scheduling and execution

To configure when backup jobs should be performed, you can use the following configuration option:

yaml

The {BACKUP-SCHEDULE} must be a cron expression which specifies how often backup jobs are performed. For example:

  • spec.schedule: "0 6 * * 1" - run a backup job weekly on Monday at 6 AM
  • spec.schedule: "@daily" - run a backup job once a day at midnight
  • spec.schedule: "0 */3 * * *" - run a backup job every three hours

For more information, see the Writing a CronJob specOpens in a new tab documentation.

You can also control how long a backup run may take, how many times failures are retried, and how many completed jobs are kept. These options are optional and have the following default values:

yaml
  • The spec.activeDeadlineSeconds parameter sets the maximum time a single backup run may take before Kubernetes terminates it and marks the run as failed. Because only one backup run is allowed at a time, this prevents a hung run from blocking all following scheduled backups. It is highly recommended to increase this value for large databases whose backups can take longer.
  • The spec.backoffLimit parameter sets how many times a failed backup run is retried before it is marked as failed.
  • The spec.successfulJobsHistoryLimit and spec.failedJobsHistoryLimit parameters set how many completed successful and failed backup jobs Kubernetes retains. Failed jobs are kept so that their logs can be inspected when a backup fails.

Backup directory

To specify the temporary directory where XtraBackup writes the local backup before it is uploaded to the Restic repository, use spec.backupDirectory:

yaml

Important

The value must be a subdirectory under /backup or /var/lib/mysql/backup.

Restic settings

The backup container uses ResticOpens in a new tab to upload XtraBackup output to a repository. To configure a Restic repositoryOpens in a new tab you can use the following configuration option:

yaml

The value of this parameter must be a valid URI supported by the restic init command.

In addition, you can pass extra configuration options for the Restic repository initialization and the backup procedure using the following configuration options:

yaml

The list of supported options you can find in the official documentation for the initOpens in a new tab and backupOpens in a new tab commands.

To save disk space and apply a retention policy, you can remove old backups using the following configuration options:

yaml

If you set the spec.additionalResticOpts.pruneRepository to true and do not specify --prune in spec.additionalResticOpts.pruneExtraArgs, only metadata of the affected snapshots is removed. Include --prune in spec.additionalResticOpts.pruneExtraArgs if you also want Restic to remove unreferenced data.

If you set spec.additionalResticOpts.pruneRepository to true, you must also specify a retention policy in spec.additionalResticOpts.pruneExtraArgs (for example, --keep-last 7). The backup job runs the restic forget command with these arguments, and the command cannot run without a policy. If you leave spec.additionalResticOpts.pruneExtraArgs empty, the backup job fails with the following error:

text

For more information on pruning restic repositories, see the official documentationOpens in a new tab.

To specify the directory where Restic stores its local cache during backup operations, use spec.additionalResticOpts.cacheDir:

yaml

Backend storage credentials

Using the Restic utility, the backups are stored in one of the supported backends. These backends often need authorisation and authentication. You can use the following configuration options to refer to a Kubernetes Secret that stores settings for authorisation and authentication:

yaml

For more information, see the Back up and restore document.

Additional options for XtraBackup

You can use spec.xtradbExtraArgs to specify additional configuration options of the XtraBackupOpens in a new tab, which are passed to this utility when performing a backup:

yaml

You can find the list of available configuration options in the official documentationOpens in a new tab.