6. Warm backup
Server allows reads
1. mysqldump
2. mydumper # seek on github
● Pros
– Fast
– All storage engines
– Textual → portable
● Cons
– Slow
– More diskspace
– FLUSH TABLES
sh> mysqldump -A -F -–master-data=2 > backupdir
sh> mydumper -t 8 …
7. Hot
Hot copy of datadir
Prepare backup / run crash recovery
Formerly xtrabackup
● Pros
– Fast
– Binary log sync → PITR
– Exact copy
● Cons
– Not portable
sh> mariabackup –-backup -–targetdir=backupdir --user=buser --password=bpwd
sh> # stable from MariaDB 10.2.10+, MariaDB 10.1.26+
sh> mariabackup –-prepare -–targetdir=backupdir --user=buser –password=bpwd
sh> cd <datadir> ; rm -fr *
sh> mariabackup --copy-back -–targetdir=backupdir --user=buser –password=bpwd
sh> chown -R mysql:mysql <datadir>
sh> sudo yum install MariaDB-backup
8. Ensure binary logging is enabled
Enable Binlog
Sync Backup with Binlog
Have a Copy of your Binlogs in a Secure Place
[mysqld]
log-bin=binlog
binlog-annotate-row-events
binlog-format=ROW
expire-logs-days=14 # two weeks !BackupPolicy
my.cnf
/etc/my.cnf.d/server.cnf
b0
binlog.000001 binlog.000003binlog.000002
DROP DATABASE world
Backup synced with
binlog
--stop-position=n
--start-position=n+1
10. Replication based backup
No load on Master
Additional investment
mariadb> stop slave;
# perform backup (cold,warm or hot) – mark down position or copy master.info
# and binlog files
mariadb> start slave;
11. Cluster based backup
No impact on cluster performance
Isolate one node for backup from application
layer access e.g. using MaxScale RWSPLIT-
service
maxadmin> set server galera2 maintenance
# perform backup
maxadmin> clear server galera2 maintenance
12. Cloud based backup
Data location ?
2 geo locations recommended
Data ownership
Some legal issues
Evaluate costs