I am using a solution of backblaze B2 / duplicity / duply to create backups of my databases. I upload full backups and incremental backups to B2 using duplicity via duply. The incrementals are done similar to rsync.
My server is 100GB and my databases are currently 70GB, but I don't suspect them to grow much. I dont have a master/slave setup. I want a backup solution that allows me to backup the 70GB of databases but not require very much space during the backup process.
I decided that I could just backup the whole /var/lib/mysql
directory instead of using mysqldump
or other backup methods which requires a full backup persist on disk.
I read that in order to do this method I would have to completely turn off the mysql server, do the backup, and turn it back on. I am OK with that because duplicity does incremental backups which should only take a few minutes.
I have ran SET GLOBAL innodb_max_dirty_pages_pct = 0;
in order to make shutdown/starup as fast as can be and verified via show global status like '%dirty%';
that Innodb_buffer_pool_bytes_dirty
hovers around 0.
I also understand the caveat for InnoDB tables is that they require the exact same mysql version in order to properly restore. Is that still the case?
Is there anything I am missing and will I have a near 100% confidence that if I use the exact mysql version (mariadb in my case) that at least one of my hundreds of incremental backups will restore.
Best Answer
How does duplicity do the "incremental" backups? By doing something like rsync? Or using MySQL's binlogs?
One of the least invasive backups involves LVM.
How, you should ask? Obviously some kind of sleight of hand. Hint: a COW is involved.
But, alas, you have to plan ahead and set up a "Logical Volume" for this to work with. And the OS has to provide such. Here's how it works:
More info on the LV and the snapshot in the LV:
Other notes...
mysql_upgrade
. You could even test an upgrade right there in the snapshot -- without copying to elsewhere. (Note: the LV would need to be big enough for whatever changes in it.)