RightScale's MySQL-EBS ServerTemplates provide additional control for archiving your EBS snapshots.
In those ServerTemplates, use the following input parameters to control the number of EBS snapshots to archive and save. The logic behind the archiving of snapshots uses the "DB_LINEAGE_NAME" (11H1) or "DB_EBS_PREFIX" (v1 & v2) inputs to identify which snapshots should be saved. Therefore, if you manually change the name of a snapshot, the archiving logic will no longer apply to that snapshot. This functionality may be useful for making sure that a particular snapshot will not be accidentally deleted by the system.
The "DB_BACKUP_KEEP_LAST" input is mandatory while the other inputs are optional.
|DB_BACKUP_KEEP_LAST||Defines how many of the last completed snapshots to keep. Value must be greater than zero. It counts from the latest snapshot backwards and preserves all backups in its count. (Default: 60)|
|DB_BACKUP_DAILY||Defines how many daily backups to keep. A daily backup is defined as the latest completed snapshot of a day that is closest to the end of the day (23:59:59). (Default: 14)|
|DB_BACKUP_WEEKLY||Defines how many weekly backups to keep. A weekly backup is defined as the latest completed snapshot of a week that is closest to the end of the week (Sunday 23:59:59). Monday is the first day of the week, Sunday is the last. (Default: 6)|
|DB_BACKUP_MONTHLY||Defines how many monthly backups to keep. A monthly backup is defined as the latest completed snapshot of a month that is closest to the end of the month (e.g. Jan-31; 23:59:59). (Default: 12)|
|DB_BACKUP_YEARLY||Defines how many yearly backups to keep. A yearly backup is defined as the latest completed snapshot of a year that is closest to the end of the year (e.g. Dec-31; 23:59:59). (Default: 2)|
Any changes to these input parameters will take effect immediately and cannot be reverted back to a previous state. For example, if you change your monthly backups from 6 to 4, the 2 oldest monthly backup snapshots will be deleted.
If all periods have one or more snapshots in them, the number specified in the inputs will exactly correspond to how many snapshots to keep for the last "n" period. For example, if you want 10 dailies and there are no holes or days where there are no snapshots in the history, you will end up keeping 1 backup for each one of the last 10 days.
If there are periods for which no backups exist at all due to a failed or deleted snapshot, the system will ignore them, and will continue going back in time until the number specified by the inputs has been fulfilled. In these cases, you will end up keeping the same number of backups, but they will span further into the past depending on how many snapshots are missing. For example, if you want to keep 10 dailies but last week you had 2 days for which no snapshot were generated, you will still keep 10 snapshots, but the oldest one being 12 days ago. If a snapshot fails (for whatever reason), the process will now sleep for a minute and retry (for a maximum of 2 retries).
Today's snapshots are not considered in the snapshot equation. For example, if you want to keep 3 dailies, the system will not consider today's snapshots as part of the equation. Snapshots of the three previous days will be archived. The equation will always start from yesterday and count backwards. The same logic applies to weeklies, monthlies, and yearlies, where the first snapshot to keep must be found in the last completed period. DB_BACKUP_KEEP_LAST, on the other hand, truly keeps the last 'N' backups that are completed including today's snapshots.
The alert for the EBS Snapshot records the time since the last successful snapshot, tracking both snapshot failures and when snapshots are disabled. You can set this alert to generate a notification if the age of the last snapshot exceeds n hours and get notified regardless if it is a failure or simply if snapshots are disabled.
Below is an example that helps show how the logic behind the archiving of snapshots can be applied to a setup where two EBS snapshots are saved each day.
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.