holland-backup / holland

Holland Backup Manager
http://hollandbackup.org
Other
152 stars 49 forks source link

InnoBackupex Incremental support #176

Open Rockstar04 opened 7 years ago

Rockstar04 commented 7 years ago

Would it be possible, or within Hollands current scope to support InnoBackupex incremental backups?

ryanpwzhu commented 5 years ago

Want to ask about this too: are there plans to add support for incremental backups with XtraBackup?

soulen3 commented 5 years ago

I'd like to add this, but don't have a timeline for it. There will be some complexity in making sure holland doesn't purge a full backup (making an incremental backup useless), and we'll need to add configuration options to define how these backups should be handle. If the framework is setup correctly, we should be able support several different incremental options.

crishoj commented 2 years ago

I've been tinkering with configuration for incremental backups using the mariabackup plugin.

Define a full backup set with these extra options:

[mariabackup]
additional-options = --extra-lsndir=/tmp/lsn-full

[holland:backup]
create-symlinks = yes
after-backup-command = cp /tmp/lsn-full/xtrabackup_info /tmp/lsn-full/xtrabackup_checkpoints ${backupdir}/

After completion of the full backup set, a non-compressed copy of the extrabackup_* LSN files required for incremental backups will be available in the backup directory:

--- Starting backup run ---
Creating backup path /var/spool/holland/full/20220322_231430
Executing: /bin/mariabackup --defaults-file=/var/spool/holland/full/20220322_231430/my.cnf --backup --stream=xbstream --tmpdir=/var/spool/holland/full/20220322_231430 --slave-info --extra-lsndir=/tmp/lsn-full --target-dir=/var/spool/holland/full/20220322_231430
  > /var/spool/holland/full/20220322_231430/backup.mb.gz 2 > /var/spool/holland/full/20220322_231430/mariabackup.log
Final on-disk backup size 87.92GB
Backup completed in 10 minutes, 59.99 seconds
 [after-backup-command]> cp /tmp/lsn-full/xtrabackup_info /var/spool/holland/full/20220322_231430/

Now define an incremental to perform an incremental backup based on the latest full backup:

[holland:backup]
create-symlinks = yes
after-backup-command = cp /tmp/lsn-incremental/xtrabackup_info /tmp/lsn-incremental/xtrabackup_checkpoints ${backupdir}/

[mariabackup]
additional-options = --incremental-basedir=/var/spool/holland/full/newest,--extra-lsndir=/tmp/lsn-incremental

This backup should be run once, after the full backup:

--- Starting backup run ---
Creating backup path /var/spool/holland/incremental/20220322_234344
Executing: /bin/mariabackup --defaults-file=/var/spool/holland/incremental/20220322_234344/my.cnf --backup --stream=xbstream --tmpdir=/var/spool/holland/incremental/20220322_234344 --slave-info --incremental-basedir=/var/spool/holland/full/newest --extra-lsndir=/tmp/lsn-incremental --target-dir=/var/spool/holland/incremental/20220322_234344
  > /var/spool/holland/incremental/20220322_234344/backup.mb.gz 2 > /var/spool/holland/incremental/20220322_234344/mariabackup.log
Final on-disk backup size 3.46GB
Backup completed in 2 minutes, 9.86 seconds
 [after-backup-command]> cp /tmp/lsn-incremental/xtrabackup_info /tmp/lsn-incremental/xtrabackup_checkpoints /var/spool/holland/incremental/20220322_234344/

Subsequent incremental backups should be based on the latest incremental backup. I figure this requires a third backup set, subsequent, with a different --incremental-basedir option:

[mariabackup]
additional-options = --incremental-basedir=/var/spool/holland/incremental/newest,--extra-lsndir=/tmp/lsn-incremental

To enable repeated incremental backups, create a symlink in the spool directory for incremental as subsequent.

Scheduling the commands: