Configure periodic backups of MariaDB
After the management cluster deployment, the cluster configuration includes the MariaDB backup functionality. The Kubernetes cron job responsible for the MariaDB backup is enabled by default. For the MariaDB backup workflow, see Workflows of the OpenStack database backup and restoration.
Warning
A local volume of only one node of a management cluster is selected when the backup is created for the first time. This volume is used for all subsequent backups.
If the node containing backup data must be redeployed, first move the MySQL backup to another node and update the PVC binding along with the MariaDB backup job to use another node as described in Change the storage node for MariaDB.
To manually create a MariaDB database backup:
kubectl -n kaas create job --from=cronjob/mariadb-phy-backup mariadb-phy-backup-manual-001
To modify the default backup configuration for MariaDB:
Select from the following options:
If the management cluster is not bootstrapped yet, proceed to the next step.
If the management cluster is already deployed, verify that the
mariadb-phy-backupCronJobobject is present:kubectl -n kaas get cronjob mariadb-phy-backup
Example of a positive system response:
NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE mariadb-phy-backup 0 0 * * * False 0 6h3m 10d
If the object is missing, make sure that your management cluster is successfully upgraded to the latest version.
Select from the following options:
If the management cluster is not bootstrapped yet, modify
cluster.yaml.templateusing the steps below.If the management cluster is already deployed, modify the configuration kubectl edit <mgmtClusterName> using the steps below. By default, the management cluster name is
kaas-mgmt.
Enable the MariaDB backup in the
Clusterobject:spec: providerSpec: value: kaas: management: helmReleases: ... - name: iam values: keycloak: mariadb: conf: phy_backup: enabled: true
Modify the configuration as required. By default, the backup is set up as follows:
Runs on a daily basis at 00:00 AM
Creates full backups daily
Keeps 5 latest full backups
Saves backups to the
mariadb-phy-backup-dataPVCThe backup timeout is
21600secondsThe backup type is
full
The
mariadb-phy-backupcron job launches backups of the MariaDB Galera cluster. The job accepts settings through parameters and environment variables.Modify the following backup parameters that you can pass to the cron job and override from the
Clusterobject:Modify the following environment variables that you can pass to the cron job and override from the
Clusterobject:
Configuration example:
To perform full backups monthly and incremental backups daily at 02:30 AM and
keep the backups for the last six months, configure the database backup in your
Cluster object as follows:
spec:
providerSpec:
value:
kaas:
management:
helmReleases:
- name: iam
values:
keycloak:
mariadb:
conf:
phy_backup:
enabled: true
backups_to_keep: 6
schedule_time: '30 2 * * *'
full_backup_cycle: 2628000
See also