Not the answer you need?
Register and ask your own question!

Full and Incremental backups are the same size

monckymoncky EntrantCurrent User Role Contributor
I'm having an issue where by my incremental and full backups are the same size.
I am taking a full backup like this:
 innobackupex --login-path=mylogin /mnt/backups/full_backups --no-timestamp  --parallel=${PARALLEL_THREADS} --compress --compress-threads=${COMPRESSION_THREADS}

Once its complete I then do this to generate and xbstream file which is pushed up to S3 by another script:
innobackupex --login-path=mylogin --stream=xbstream  /mnt/backups/full_backups/latest_backup --parallel=${PARALLEL_THREADS} --compress --compress-threads=${COMPRESSION_THREADS} > latest_backup.xbstream

Once every hour I also take an incremental backup, thusly
innobackupex --login-path=mylogin --stream=xbstream --incremental /mnt/backups/incremental_backups --incremental-basedir= /mnt/backups/full_backups/latest_backup --no-timestamp  --parallel=${PARALLEL_THREADS} --compress --compress-threads=${COMPRESSION_THREADS} > incremental_backup.xbstream

the incremental backup appears to also includ the full backup.  I am beyond a doubt doing something wrong. but have been unable to work out what it is.

If anyone can point me in the correct direction for doing this id appreciate it
In the end all I want is a Daily backup of my database in a compressed xbstream archive, with an hourly incremental where each incremental uses the daily as its base reference.


Answers

  • jriverajrivera Percona Support Engineer Percona Staff Role
    Moncky,
    First, we would recommend you to use the xtrabackup command instead of the innobackupex command since innobackupex has been deprecated and removed in PXB version 8.0.
    Now with regards to the backup commands, you are missing the --extra-lsndir option to save the xtrabackup_checkpoints file in the fullbackup directory. This file is read by xtrabackup during incremental backup to read at which LSN it will start backing up.
    I would suggest using this command to test:
    xtrabackup --login-path=mylogin --stream=xbstream  --target-dir=/mnt/backups/full_backups/latest_backup --parallel=${PARALLEL_THREADS} --compress --compress-threads=${COMPRESSION_THREADS} --extra-lsn=/mnt/backups/full_backups/latest_backup > latest_backup.xbstream
    Then incremental with:
    xtrabackup --login-path=mylogin --stream=xbstream --target-dir=/mnt/backups/incremental_backups --incremental-basedir= /mnt/backups/full_backups/latest_backup  --parallel=${PARALLEL_THREADS} --compress --compress-threads=${COMPRESSION_THREADS} --extra-lsndir=/mnt/backups/incremental_backups > incremental_backup.xbstream
    The checkpoints file should look something like this on the full and incremental backup:
    [[email protected] ~]# cat backup/full/xtrabackup_checkpoints
    backup_type = full-backuped
    from_lsn = 0
    to_lsn = 41480260
    last_lsn = 41480270
    flushed_lsn = 0
    [[email protected] ~]# cat backup/inc/xtrabackup_checkpoints
    backup_type = incremental
    from_lsn = 41480260
    to_lsn = 41480290
    last_lsn = 41480300
    flushed_lsn = 0
    Observe that on the full backup from_lsn is 0 and on the incremental the backup starts on from_lsn=41480260 which is the to_lsn of the full backup. Another alternative to --extra-lsndir is the use of the --history flag - https://www.percona.com/doc/percona-xtrabackup/2.4/xtrabackup_bin/xbk_option_reference.html#cmdoption-xtrabackup-history

Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.