Pre Backup Plugin

From wiki.zmanda.com
Jump to navigation Jump to search

Pre Backup plugin is called by mysql-zrm before the backup run for a backup set is started. This plugin can be used to check and prepare the MySQL server environment for backup. For example it could be used to notify all MySQL database users that a backup is going to begin.

Configuration

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

The pre-backup-plugin 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 is the name of pre-backup-plugin-option specified in the mysql-zrm.conf configuration file.

The second parameter to the plugin is the databases/tables that will be backed up in the backup run. The parameter can be one of the following:

  • --all-databases - all databases in the MySQL server are being backed up
  • --database <db1 db2 ...> - select list of databases are being backed up
  • --database <db> and --tables <table1 table2 ...> - select list of tables in the database that are being backed up.

The plugin should return 0 on success and and non-zero value on failure. If the pre-backup plugin fails, the backups are not attempted and backup status is set to "Backup failed".

Template

/usr/share/mysql-zrm/plugins/pre-backup.pl is a template for the pre-backup plugin. Modify it to suit the environment.

Logs

Errors and Messages from the plugin are logged to mysql-zrm logs ( /var/log/mysql-zrm/mysql-zrm.log ).