Delaying A Backup Run

From The Open Source Backup Wiki (Amanda, MySQL Backup, BackupPC)
Jump to navigationJump to search

ZRM for MySQL has plugins to extend the ZRM backups so that you could delay/defer backups when the server is under use by many users.

You will need to tailor the Pre Scheduler plugin to achieve this objective.

  • It is an optional plugin.
  • Its template has been provided.
  • This can be altered to suit the specific needs of each installation.
  • Plugins can be written in any language/script and should be executable files.
  • All plugins need to be specified along with their full path names.

Pre Scheduler Plugin

Pre Scheduler plugin is called by mysql-zrm before the start of the scheduled backup run. This plugin can be used to check the MySQL server environment and delay the backup in hourly intervals, or to even skip it, if it is too busy for the backup. This can be useful when backups are being done for 24*7 mission critical databases.

For example it could be used to do backups only when the MySQL application load or server load is below a certain minimum threshold. It could also be used to prevent backups when MySQL application or database is being upgraded.

Configuration

Pre Scheduler plugin can be configured in the global mysql-zrm.conf or in specific backup set mysql-zrm.conf configuration file. Additionally, from the command line, the pre-scheduler-plugin-options parameter can be used to send a list of parameters to the pre-backup plugin.

The pre-scheduler parameter should include the name and the full path to the plugin. The recommended location for plugins is /usr/share/mysql-zrm/plugins directory.

Plugin Interface

The first parameter to the plugin is the backup set name in the form --backup-set <backup-set-name>.

If plugin returns 0, backups are performed immediately. If the plugin returns "n" where n is a positive integer less than or equal to 11, the backup run is tried again after "n" hours. If the plugin returns any number greater than 11, the backup run is skipped. Skipping a backup run does not have any impact on the other scheduled backup runs for the backup set. So, the backup can be delayed upto 11 hours in one execution of the plugin.

The mysql-zrm-scheduler will skip a daily backup run if the pre-scheduler plugin does not find a suitable time (has not returned 0 ) to do a backup within 24 hours from the initial scheduled time.

For weekly or monthly backup runs, this tool will perform a backup at the end of the 24 hours from the initial scheduled time even if pre-scheduler plugin does not found a suitable time in the 24 hours cycle.

Template

/usr/share/mysql-zrm/plugins/pre-scheduler-plugin.pl is a template for a pre scheduler plugin. The example plugin pre-scheduler-plugin.pl uses the number of processes running in the system to estimate the server load and delay the backup by 1 or 2 hours. If the number of server process is higher than a threshold, it skips the backup run by returning a number greater than 11. Modify it to suit the environment.