Hello,

Regarding snapshot backups, with the MariaDB operator on Kubernetes, physical backups can be performed with Kubernetes VolumeSnapshots. This is done with the “PhysicalBackup” resource, specifying the storage type “volumeSnapshot” and a compatible VolumeSnapshotClass:

```
apiVersion: k8s.mariadb.com/v1alpha1
kind: PhysicalBackup
metadata:
 name: physicalbackup
spec:
 mariaDbRef:
   name: mariadb
 storage:
   volumeSnapshot:
     volumeSnapshotClassName: csi-hostpath-snapclass
```

According to the MariaDB operator documentation, the snapshot is taken as follows:

- Temporarily pause the MariaDB writes by executing a `FLUSH TABLES WITH READ LOCK` command in one of the secondary Pods. - Create a VolumeSnapshot resource of the data PVC mounted by the MariaDB primary Pod. - Wait until the VolumeSnapshot is provisioned by the storage system. When timing out, the operator will delete the VolumeSnapshot resource and retry the operation.
- Issue a `UNLOCK TABLE` statement.

(https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/physical_backup.md#volumesnapshots)

I'm asking myself a few questions on this strategy :
- Does it work with Galera clusters ? (In principle, yes; the example given in the documentation uses Galera). - Does it handle Galera desynchronization correctly, as explained in https://mariadb.com/docs/galera-cluster/galera-management/general-operations/backing-up-a-mariadb-galera-cluster ?
- How do you perform a clean restore when using Galera ?

So far, until MariaDB 12.3 is out, the binlogs are not restored with this strategy. I'll have to backup them in another way. They should be saved in the VolumeSnapshots, however, starting with MariaDB 12.3 if I understand correctly : the binlog_storage_engine=innodb parameter allows binlogs to be stored in the InnoDB engine, instead of separate binary files (mysql-bin.*). Binlogs will become an integral part of InnoDB data files, so they will be included in the snapshot (tell me if I'm wrong).

Instead of using the MariaDB operator to perform the snapshot, could the volume snapshot be achieved with a tool like Kasten? Kasten probably won't do "FLUSH TABLES WITH READ LOCK" before the snapshot, in particular, but I guess we could create pre-exec and post-exec hooks.

If anyone has some insights on this strategy, I would appreciate your feedback.

As this is a specifig backup strategy based on Kubernetes, let me know if you want me to create a new post.

Best regards,
Xavier


_______________________________________________
discuss mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to