ShahriyarR / MySQL-AutoXtraBackup

MySQL-AutoXtraBackup commandline tool written in Python 3 based on Percona XtraBackup
https://autoxtrabackup.azepug.az/
MIT License
141 stars 78 forks source link

Make archiving backups more configurable #257

Closed prox2k closed 6 years ago

prox2k commented 6 years ago

Hi Shahriyar,

before we cleaning archive directories we keep at least the first backup from the week and the first backup from the month to have another option when not realizing that the last 6-7 daily backups are corrupted or some data were deleted before we want to restore. Maybe it would be enough to have some configuration-options, instead of "max_archive_duration":

archive_days=10 // keeps 10 full and there incremental of last 10 days archive_weeks=1 // keeps first backup of each week archive_months=1 // keeps first backup of each month

ore something like that. What do you think?

ShahriyarR commented 6 years ago

@prox2k maybe you can clarify a bit what you need here exactly? :) As I remember when max_archive_duration expires the tool will prepare and then archive all available backups. Isn't it?

prox2k commented 6 years ago

@ShahriyarR makes sense. is there anything which clean up/deletes "old" archived backups?

ShahriyarR commented 6 years ago

@prox2k that is good question. Currently I did not remember such thing. Let me check. So you need to clean "old" archives as well?

prox2k commented 6 years ago

@ShahriyarR yep, that would be great. saying delete backups after 2 weeks, but keep the first backup of a month, or keep the first backup of a week (good when using only daily full backups)

ShahriyarR commented 6 years ago

@prox2k According to this line: https://github.com/ShahriyarR/MySQL-AutoXtraBackup/blob/release_v1.5.2/master_backup_script/backuper.py#L249

We have the archive cleaner but it depends on max_archive_duration and if specified max_archive_size options. What I can do here to create max_keep_archive option to store archived backups for given time. If this option was specified - it will check if time is expired it will delete the expired archives and will store the relatively newer archives. Exactly saying you have set max_archive_duration to 1 day and max_keep_archive to 10 days. During each backup it will create new archive and will check if there are any backup that is older than 10 days. This will guarantee, you will have 10 newest archives for all time.

Is this solution good for you?

ShahriyarR commented 6 years ago

Closing as there was no attention :)