- It is mandatory ? necesserally ? What the risks of do not use this option after my backup.
Well, first I’m going to explain how xtrabackup works. It copies the ibd files without locking the tables, that means that while you are copying a table it can be modified by your users, therefore you are making a inconsistent backup. While those ibd files are copied, there is another thread that checks the changes to the innodb log files and store them on another file.
–apply-log read that file with the changes from innodb log files and applied them to the tablespace. So, --apply-log makes your backup consistent and should be run before restoring the backup.
- If is mandatory, why this option is not included by default in innobackupex ? By example with the stream option, i make my backup, and my backup is compressed ok ?
Because not everybody wants to apply logs just after getting a backup. There can be lot of different reasons, I’m going to give you two examples where automatically applying the backup is not good idea:
- apply-log is a time/resources consuming process so run it just after the backup is not always a good idea. Sometimes is better to move the backup to a server with spare power capacity to run the apply-log there.
- if you want to get incremental backups, then you shouldn’t apply the base backup
- If i do not my --apply-log. I have my backup. I wait one or two weeks. I want to restore my backup, can i to do the --apply-log empty risks ? and if i lost my server (crash?)
You can do the --apply-log whenever you want, it doesn’t need a running mysql. It will just read a file from the backup with the changes it needs to apply, and will apply them. Here you have more information about what that --apply-log means: