There are two types of operations to bring your backup data up-to-date:
After a backup job was first completed, the backup data might not be in a consistent state, because data could have been inserted, updated, or deleted while the backup was running. This initial backup file is known as theraw backup. During a backup,mysqlbackup also copies the accumulated InnoDB log to a file calledibbackup_logfile. In an apply-log operation, theibbackup_logfile file is used to“roll forward” the raw data files, so that every page in the data files corresponds to the same log sequence number of the InnoDB log. This is similar to the operation that takes place during acrash recovery.
For single-file backups, the apply-log operation is usually performed as part of thecopy-back-and-apply-log command. For directory backups, thecopy-back-and-apply-log command can also be used, but you also have the two alternatives of
Performing the apply-log operation together with the back up using the
backup-and-apply-logcommand (not applicable for incremental or compressed directory backups)Performing the apply-log operation separately with the
apply-logcommand on the raw backup, before running thecopy-backcommand.
mysqlbackup [STD-OPTIONS] [--limit-memory=MB] [--uncompress] [--backup-dir=PATH] [MESSAGE-LOGGING-OPTIONS] [PROGRESS-REPORT-OPTIONS] [ENCRYPTED-INNODB-OPTIONS] apply-logAdvanced: Brings the InnoDB tables in the directory backup up-to-date, including any changes made to the data while the backup was running.
Example 19.1 Apply Log to Full Backup
mysqlbackup --backup-dir=/path/to/backup apply-log It reads thebackup-my.cnf file insidebackup-dir to understand the backup. Themy.cnf defaults files have no effect other than supplying thelimit-memory= value, which limits usage of memory while doing theMBapply-log operation.
Advanced: Use theapply-incremental-backup to update a backup directory with data in an incremental backup directory:
mysqlbackup [STD-OPTIONS] [--incremental-backup-dir=PATH] [--backup-dir=PATH] [--limit-memory=MB] [--uncompress] [MESSAGE-LOGGING-OPTIONS] [PROGRESS-REPORT-OPTIONS] [ENCRYPTED-INNODB-OPTIONS] apply-incremental-backupAdvanced: Brings up-to-date a directory backup specified with the--backup-dir option, using the data from an incremental backup directory specified with the--incremental-backup-dir option. SeeSection 5.1.3, “Restoring an Incremental Backup” for instructions on restoring incremental backups.
For a single-file incremental backup, you typically use thecopy-back-and-apply-log command to apply the data in the incremental image backup to the full backup that has already been restored to the data directory of the target server.