Mirantis Container Cloud (MCC) becomes part of Mirantis OpenStack for Kubernetes (MOSK)!
Starting with MOSK 25.2, the MOSK documentation set covers all product layers, including MOSK management (formerly Container Cloud). This means everything you need is in one place. Some legacy names may remain in the code and documentation and will be updated in future releases. The separate Container Cloud documentation site will be retired, so please update your bookmarks for continued easy access to the latest content.
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:MariaDB backup: Configuration parameters¶ Parameter
Default
Description
--backup-type(string)fullBackup type. The list of possible values include:
incrementalIf the newest full backup is older than the value of the
full_backup_cycleparameter, the system performs a full backup. Otherwise, the system performs an incremental backup of the newest full backup.
fullAlways performs only a full backup.
Usage example:
spec: providerSpec: value: kaas: management: helmReleases: - name: iam values: keycloak: mariadb: conf: phy_backup: backup_type: incremental
--backup-timeout(integer)21600Timeout in seconds for the system to wait for the backup operation to succeed.
Usage example:
spec: providerSpec: value: kaas: management: helmReleases: - name: iam values: keycloak: mariadb: conf: phy_backup: backup_timeout: 30000
--allow-unsafe-backup(boolean)falseIf set to
true, enables the MariaDB cluster backup on a not fully operational cluster where:The current number of ready pods is not equal to
MARIADB_REPLICASSome replicas do not have healthy wsrep statuses
Usage example:
spec: providerSpec: value: kaas: management: helmReleases: - name: iam values: keycloak: mariadb: conf: phy_backup: allow_unsafe_backup: true
Modify the following environment variables that you can pass to the cron job and override from the
Clusterobject:MariaDB backup: Environment variables¶ Variable
Default
Description
MARIADB_BACKUPS_TO_KEEP(integer)10Number of full backups to keep.
Usage example:
spec: providerSpec: value: kaas: management: helmReleases: - name: iam values: keycloak: mariadb: conf: phy_backup: backups_to_keep: 3
MARIADB_BACKUP_PVC_NAME(string)mariadb-phy-backup-dataPersistent volume claim used to store backups.
Usage example:
spec: providerSpec: value: kaas: management: helmReleases: - name: iam values: keycloak: mariadb: conf: phy_backup: backup_pvc_name: mariadb-phy-backup-data
MARIADB_FULL_BACKUP_CYCLE(integer)604800Number of seconds that defines a period between 2 full backups. During this period, incremental backups are performed. The parameter is taken into account only if
backup_typeis set toincremental. Otherwise, it is ignored. For example, withfull_backup_cycleset to604800seconds, a full backup is performed weekly and, if cron is set to0 0 * * *, an incremental backup is performed daily.Usage example:
spec: providerSpec: value: kaas: management: helmReleases: - name: iam values: keycloak: mariadb: conf: phy_backup: full_backup_cycle: 70000
MARIADB_BACKUP_REQUIRED_SPACE_RATIO(floating)1.2Multiplier for the database size to predict the space required to create a backup, either full or incremental, and perform a restoration keeping the uncompressed backup files on the same file system as the compressed ones.
To estimate the size of
MARIADB_BACKUP_REQUIRED_SPACE_RATIO, use the following formula: size of (1 uncompressed full backup + all related incremental uncompressed backups + 1 full compressed backup) in KB =< (DB_SIZE*MARIADB_BACKUP_REQUIRED_SPACE_RATIO) in KB.The
DB_SIZEis the disk space allocated in the MySQL data directory, which is/var/lib/mysql, for databases data excludinggalera.cacheandib_logfile*files. This parameter prevents the backup PVC from being full in the middle of the restoration and backup procedures. If the current available space is lower thanDB_SIZE*MARIADB_BACKUP_REQUIRED_SPACE_RATIO, the backup script fails before the system starts the actual backup and the overall status of the backup job is failed.Usage example:
spec: providerSpec: value: kaas: management: helmReleases: - name: iam values: keycloak: mariadb: conf: phy_backup: backup_required_space_ratio: 1.4
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