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.
Workflows of the OpenStack database backup and restoration¶
This section provides technical details about the internal implementation of automated backup and restoration routines built into MOSK. The below information would be helpful for troubleshooting of any issues related to the process or understanding the impact these procedures impose on a running cloud.
Backup workflow¶
The OpenStack database backup workflow consists of the following phases.
Backup phase 1¶
The mariadb-phy-backup job is responsible for:
- Performing basic sanity checks and choosing right node for backup 
- Verifying the wsrep status and changing the - wsrep_desyncparameter settings
- Checking backup integrity (ensuring correct hash sums) 
- Managing the - mariadb-phy-backup-runnerpod
- If enabled, synchronizing the local backup storage with the remote S3 storage 
During the first backup phase, the following actions take place:
- The - mariadb-phy-backuppod starts on the node where the- mariadb-serverreplica with the highest number in its name runs. For example, if the MariaDB server pods are named- mariadb-server-0,- mariadb-server-1, and- mariadb-server-2, the- mariadb-phy-backuppod starts on the same node as- mariadb-server-2.
- The backup process verifies the hash sums of existing backup files based on ConfigMap information: - If the verification fails and synchronization with the remote S3 storage is enabled, the process checks the hash sums of remote backups as well. If the remote backups are valid, they are downloaded. 
- If the hash sums are incorrect for both local and remote backups, the backup job fails. 
- If no ConfigMap exists, these hash sum checks are skipped. 
 
- Sanity check: verification of the Kubernetes status and wsrep status of each MariaDB pod. If some pods have wrong statuses, the backup job fails unless the - --allow-unsafe-backupparameter is passed to the main script in the Kubernetes backup job.- Note - Since MOSK 22.4, the - --allow-unsafe-backupfunctionality is removed from the product for security and backup procedure simplification purposes.- Mirantis does not recommend setting the - --allow-unsafe-backupparameter unless it is absolutely required. To ensure the consistency of a backup, verify that the MariaDB Galera cluster is in a working state before you proceed with the backup.
- Desynchronize the replica from the Galera cluster. The script connects the target replica and sets the - wsrep_desyncvariable to- ON. Then, the replica stops receiving write-sets and receives the wsrep status- Donor/Desynced. The Kubernetes health check of that- mariadb-serverpod fails and the Kubernetes status of that pod becomes- Not ready. If the pod has the- primarylabel, the MariaDB Controller sets the- backuplabel to it and the pod is removed from the endpoints list of the MariaDB service.
- Verify that there is enough space in the - /var/backupfolder to perform the backup. The amount of available space in the folder should exceed- <DB-SIZE> * <MARIADB-BACKUP-REQUIRED-SPACE-RATIO>in KB.
Backup phase 2¶
- The - mariadb-phy-backuppod performs the backup using the mariabackup tool.
- The script puts the backed up replica back to sync with the Galera cluster by setting - wsrep_desyncto- OFFand waits for the replica to become- Readyin Kubernetes.
Backup phase 3¶
- The script calculates hash sums for backup files and stores them in a special ConfigMap. 
- If the number of existing backups exceeds the value of the - MARIADB_BACKUPS_TO_KEEPjob parameter, the script removes the oldest backups to maintain the allowed limit.
- If enabled, the script synchronizes the local backup storage with the remote S3 storage. 
Restoration workflow¶
The OpenStack database restoration workflow consists of the following phases.
Restoration phase 1¶
The mariadb-phy-restore job launches the mariadb-phy-restore pod.
This pod starts with the mariadb-server PVC  with the highest number
in its name. This PVC is mounted to the /var/lib/mysql folder and the
backup PVC (or local filesystem if the hostapath backend is configured)
is mounted to /var/backup.
The mariadb-phy-restore pod contains the main restore script, which is
responsible for:
- Scaling the - mariadb-serverStatefulSet
- Verifying the statuses of - mariadb-serverpods
- Managing the - openstack-mariadb-phy-restore-runnerpods
- Checking backup integrity (ensuring correct hash sums) 
Caution
During the restoration, the database is not available for OpenStack services that means a complete outage of all OpenStack services.
During the first phase, the following actions take place:
- The restoration process verifies the hash sums of existing backup files based on ConfigMap information: - If the verification fails and synchronization with the remote S3 storage is enabled, the process checks the hash sums of remote backups as well. If the remote backups are valid, they are downloaded. 
- If the hash sums are incorrect for both local and remote backups, the backup job fails. 
 
- Save the list of - mariadb-serverpersistent volume claims (PVC).
- Scale the - mariadbserver StatefulSet to- 0replicas. At this point, the database becomes unavailable for OpenStack services.
Restoration phase 2¶
- The - mariadb-phy-restorepod performs the following actions:- Launches the - openstack-mariadb-phy-restore-runnerpod for each- mariadb-serverPVC. This pod cleans all MySQL data on each PVC.
- Collects logs from the - openstack-mariadb-phy-restore-runnerpod and then removes it.
- Unarchives the database backup files to a temporary directory within - /var/backup.
- Executes - mariabackup --prepareon the unarchived data.
- Restores the backup to - /var/lib/mysql.
 
Restoration phase 3¶
- The - mariadb-phy-restorepod scales the- mariadb-serverStatefulSet back to the configured number of replicas.
- The - mariadb-phy-restorepod waits until all- mariadb-serverreplicas are ready.