Mysql-zrm-scheduler

From wiki.zmanda.com
Revision as of 23:42, 21 November 2007 by Paddy (talk | contribs) (→‎OPTIONS)
Jump to navigation Jump to search

NAME

mysql-zrm-scheduler - backup scheduler utility for ZRM for MySQL

SYNOPSIS

mysql-zrm-scheduler --add|--query|--delete|--now
                   [--start-time <start time>]
                   [--day-of-week <day of week>]
                   [--day-of-month <day of month>]
                   [--interval <interval>]
                   [--backup-level <0|1>]
                   [--backup-set <backupset name>]
                   [--help]

DESCRIPTION

mysql-zrm-scheduler is the utility for ZRM for MySQL used to schedule MySQL backups using mysql-zrm(1).

At the scheduled time, this utility will first execute the optional pre-scheduler plugin (see Pre-Scheduler section) to determine the system load before running the backup. Otherwise, it will directly run the backup.

mysql-zrm-scheduler also implements the backup retention policy and purges mysql-zrm backup files. By default, the backup image purge action will be performed at 4:00am daily. See mysql-zrm retention-policy parameter for details.

When --now option is specified, the mysql-zrm-scheduler utility will run mysql-zrm immediately.

OPTIONS

--add
Add a mysql-zrm backup run to the schedule to run on the time specified by other options.
--delete
Delete a scheduled backup run. Use --start option to delete a scheduled run with specific time.
--query
Displays a list of backup runs scheduled.
--interval <interval>
Valid options are daily, weekly or monthly. Default: weekly
--now
Immediately do the backup of MySQL.
--backup-set <name>
Specify the backup set name for the backup run. Default is BackupSet1.
--backup-level <0|1>
Choose 0 for full backup. Choose 1 for an incremental backup. Default is 0.
--start-time <start time>
Start time for the backup run in HH:MM format. Default values are 00:00 for monthly, 02:00 for weekly and 03:00 for daily intervals.
--day-of-week <day of week>
Value used with weekly interval to specify the day(s) of week. Use a single number from 0-6 (0=Sunday, 6=Saturday), or a range of two numbers separated with a hyphen. Example: 1, to start on Monday 0-2, to start on Sunday, Monday and Tuesday. Default value is 0 (Sunday).
--day-of-month <day of month>
Value used with monthly interval to specify the day(s) of month. Use a single number from 1-31 or a range of two numbers separated with a hyphen. Interval must be set to "monthly" to use this option. Example: 2, to start on second day of the month. 10-12, to start on the 10th, 11th and 12th day of the month. Default value is 1 (first day of the month).
--help
Display help message and exits.

Pre-Scheduler

The pre-scheduler plugin has to be specified in mysql-zrm.conf(5).

mysql-zrm-scheduler calls the specified pre-scheduler plugin before the scheduled MySQL backup run. The plugin should return "0" to continue to perform MySQL backup run immediately. It should return "n" where n is a positive integer smaller or equal to 11 to delay the MySQL backup run by "n" hour(s) from the current time.

Returning any number greater than "11" would skip the scheduled MySQL backup run.

mysql-zrm-scheduler skips the daily backup run if the pre-scheduler plugin does not find a suitable time (return "0" or "n"") in 24 hours (from the initial scheduled start time).

For weekly or monthly backup run, mysql-zrm-scheduler will perform a backup run at the end of the 24 hours (from the initial scheduled start time) even if pre-scheduler plugin have not found a suitable time in the 24 hours cycle.

The pre-scheduler plugin is used to tell mysql-zrm if a backup should happen at a particular time.

It is to be customized by the user to control if at the scheduled time a backup should run or not. For example: a user has scheduled backups to happen every night at midnight. But he wants to do delay the backup if the number of users in the system is more than 5. For this the user needs to write a pre-scheduler script that can determine how many users are there in the system and inform the scheduler to go ahead and do backup or delay the backup.

EXAMPLES

To schedule a daily mysql-zrm run that starts at 1:35pm:

# mysql-zrm-scheduler --add --interval daily --start 13:35

To schedule a weekly mysql-zrm run on Tuesday and Wednesday:

# mysql-zrm-scheduler --add --interval weekly --day-of-week 2-3

To schedule a monthly mysql-zrm run on the tenth day of each month:

# mysql-zrm-scheduler --add --interval monthly --day-of-month 10

To query scheduled runs:

# mysql-zrm-scheduler --query
35 13 * * * /usr/bin/zrm-pre-scheduler --action backup --backup-set BackupSet1 --interval daily
0 2 * * 2-3 /usr/bin/zrm-pre-scheduler --action backup --backup-set BackupSet1 --interval weekly
0 0 10 * * /usr/bin/zrm-pre-scheduler --action backup --backup-set BackupSet1 --interval monthly

To delete a daily mysql-zrm run with specific start time:

# mysql-zrm-scheduler  --delete  --interval  daily --start 08:20


To delete the weekly mysql-zrm run from schedule:

# mysql-zrm-scheduler --delete --interval weekly --day-of-week 2-3

FILES

/var/lib/mysql-zrm
Directory under which all backup data is stored.
/etc/mysql-zrm/<backup set name>/mysql-zrm.conf
Configuration file read by mysql-zrm utility.

RETURN VALUES

On success, zero is returned. On error, non-zero value is returned.

SEE ALSO

mysql-zrm(1), mysql-zrm.conf(5), mysql-zrm-reporter(1), mysql(1), Zmanda Recovery Manager for MySQL.

AUTHOR

Zmanda Inc. (http://www.zmanda.com)