-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Physical backups via mariabackup
#11
Comments
There's still a role for the venerable mysqldump as a logical backup as its a good mitigator for the odd corruption bugs of database tables that mariabackup (and others like aria-hotcopy) physical backup programs don't mitigate. So I'd consider an addition rather than replacement. |
@grooverdan thanks for the clarification, it does makes sense. We could extend our CRD so the user could choose the apiVersion: database.mmontes.io/v1alpha1
kind: BackupMariaDB
metadata:
name: backup
spec:
type: (logical | physical)
mariaDbRef:
name: mariadb
storage:
persistentVolumeClaim:
resources:
requests:
storage: 100Mi
storageClassName: standard
accessModes:
- ReadWriteOnce |
Reopening, see: |
I've managed to restore a physical backup in a
apiVersion: mariadb.mmontes.io/v1alpha1
kind: MariaDB
metadata:
name: mariadb-galera
spec:
rootPasswordSecretKeyRef:
name: mariadb
key: root-password
database: mariadb
username: mariadb
passwordSecretKeyRef:
name: mariadb
key: password
image:
repository: mariadb
tag: "11.0.3"
pullPolicy: IfNotPresent
port: 3306
replicas: 3
galera:
enabled: true
volumeClaimTemplate:
resources:
requests:
storage: 1Gi
accessModes:
- ReadWriteOnce
volumes:
- name: mariabackup
persistentVolumeClaim:
claimName: mariabackup
volumeMounts:
- name: mariabackup
mountPath: /var/mariadb/backup/
mariabackup --backup --target-dir=/var/mariadb/backup/ --user=root --password=mariadb
mariabackup --prepare --target-dir=/var/mariadb/backup/
apiVersion: mariadb.mmontes.io/v1alpha1
kind: MariaDB
metadata:
name: mariadb-galera
spec:
rootPasswordSecretKeyRef:
name: mariadb
key: root-password
database: mariadb
username: mariadb
passwordSecretKeyRef:
name: mariadb
key: password
image:
repository: mariadb
tag: "11.0.3"
pullPolicy: IfNotPresent
port: 3306
replicas: 3
galera:
enabled: true
# See: https://mariadb.com/kb/en/full-backup-and-restore-with-mariabackup/
initContainers:
- image:
repository: mariadb
tag: "11.0.3"
pullPolicy: IfNotPresent
args:
- mariabackup
- --copy-back
- --target-dir=/var/mariadb/backup/
volumeClaimTemplate:
resources:
requests:
storage: 1Gi
accessModes:
- ReadWriteOnce
volumes:
- name: mariabackup
persistentVolumeClaim:
claimName: mariabackup
volumeMounts:
- name: mariabackup
mountPath: /var/mariadb/backup/
MariaDB [(none)]> use mariadb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mariadb]> show tables;
+-------------------+
| Tables_in_mariadb |
+-------------------+
| repos |
| stars |
| users |
+-------------------+
3 rows in set (0.000 sec)
MariaDB [mariadb]> select * from stars;
+-----+---------+---------+
| id | user_id | repo_id |
+-----+---------+---------+
| 318 | 3 | 1 |
| 383 | 9 | 1 |
| 335 | 12 | 4 |
| 380 | 15 | 7 |
| 277 | 18 | 4 |
| 391 | 18 | 7 |
+-----+---------+---------+
6 rows in set (0.000 sec) |
Can |
@grooverdan not sure If I'm understanding. If I utilize |
Yep, |
Great, I've updated the example to use Maybe this docs need to be updated as well?: |
See relevant PR for |
mariabackup
instead of mysqldump
mariabackup
MariaDB has its own backup command to perform backups, we should migrate to use it:
Usage can be found here under the
Creating backups with Mariabackup
section:The text was updated successfully, but these errors were encountered: