Mysql-zrm-scheduler: Difference between revisions

From wiki.zmanda.com
Jump to navigation Jump to search
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
== NAME ==
==NAME==


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


== SYNOPSIS ==
==SYNOPSIS==


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


== DESCRIPTION ==
==DESCRIPTION==
mysql-zrm-scheduler  is  the  utility  for ZRM for MySQL used to schedule MySQL backups using [[mysql-zrm-backup]](1).


This tool  is part of Zmanda  Recovery Manager for MySQL (MySQL ZRM).  This tool should be 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 backupIf no  pre-scheduler plugin  exists, it will directly run the backup.


At the scheduled time, this tool will execute the pre-scheduler plugin (optional, see [[#Pre-Scheduler|Pre-Scheduler]] section) to determine the system load.
mysql-zrm-scheduler  also  implements  the backup retention policy and purges backup files. By default, the  backup  image  purge action will be performed    at  4:00am  daily.  See  [[mysql-zrm-backup]](1) --retention-policy parameter for details.


mysql-zrm-scheduler is also responsible for backup retention policy. It will also schedule jobs to purge [[mysql-zrm]] backup files based on the retention policy for the backup set. The backup image purge action will be performed at 4am daily.  See mysql-zrm [[Mysql-zrm#OPTIONS|retention-policy]] for details.
When --now option is specified,  the  mysql-zrm-scheduler utility  will run mysql-zrm immediately.


If ''--now''  option is  specified,  the  mysql-zrm-scheduler  tool  will call [[mysql-zrm]] immediately.
==OPTIONS==


== OPTIONS ==
; --add   : Add   a   mysql-zrm   backup   run to the schedule based on the time specified by other options.
     
; --add : Add a mysql-zrm backup run to the schedule based on the time specified by other options.


; --delete : Delete a scheduled backup run.  To delete a scheduled run with specific timestamp, add ''--start''  option.
; --delete : Delete a scheduled backup run. Use the --start  option to delete a scheduled run with specific time.


; --query : Displays list of backup runs scheduled.
; --query : Display a list of backup runs scheduled.


; --interval <interval> : Valid inputs are daily, weekly or monthly.
; --interval interval : Valid options  are daily, weekly or monthly. Default: weekly


; --now : Does MySQL backup now.
; --now : Immediately do the backup of MySQL.


; --backup-set <name> : Specify the backup set for the backup run. Default is BackupSet1.
; --backup-set name : Specify the backup set name for the backup run. Default is BackupSet1.


; --backup-level <0|1> : If 0 is specified, then a full backup is done. If 1 is specified, an incremental backup is done. Default is 0.
; --backup-level Level : Choose  0 for full backup. Choose 1 for  an incremental backup. Default is 0.


; --start <start time> : start time for the backup run in HH:MM format. Default value is 00:00 for monthly, 02:00 for weekly and 03:00 for daily interval.
; --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 interval.


;--day-of-week <day of week> : Single number from 0-6 (0=Sunday, 6=Saturday), or a  range of two numbers separated with a hyphen. This value is used with weekly interval. Example: 1, to start on Monday 0-2, to start on Sunday, Monday and Tuesday. Default 0 (Sunday).
; --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=Satur- day), 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> : Single number from 1-31 or a range  of two numbers  separated with a hyphen. This value is used with monthly interval.  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 1 (first day of the month).
; --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 exit.
; --help : Display help message and exits.


==Pre-Scheduler==
===Pre-Scheduler===
The mysql-zrm-scheduler tool calls the pre-scheduler plugin before
the scheduled MySQL backup run.  The plugin can ask the scheduler to
skip the backup run or delay the start of the backup run. The plugin
should return "0" to instruct this tool to perform MySQL backup run
immediately. Return "n" where n is a positive integer smaller or equal
to 11 to instruct this tool 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.<br/>


mysql-zrm-scheduler tool will skip the daily backup run if the pre-scheduler plugin could not find a suitable time ( have not returned value "0" ) 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 intial scheduled start time) even if pre-scheduler plugin have not found a
The pre-scheduler plugin has to  be specified in [[mysql-zrm.conf]](5).
suitable time in the 24 hours cycle.
<br/>
The pre-scheduler plugin is specified in [[mysql-zrm.conf]](5).<br/>


==EXAMPLES==
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.


To schedule a daily mysql-zrm run to start at 1:35pm:
The  pre-scheduler  plugin is used to tell mysql-zrm if a backup should happen at a particular time.


  # mysql-zrm-scheduler --add --interval daily --start 13:35
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.


To schedule a weekly mysql-zrm run to start on Tuesday and Wednesday:
==EXAMPLES==


# mysql-zrm-scheduler --add --interval weekly --day-of-week 2-3
* To schedule a daily mysql-zrm run that starts at 1:35pm:


To schedule a monthly mysql-zrm run to start on the tenth day of each month:
$ mysql-zrm-scheduler --add -interval daily --start 13:35


# mysql-zrm-scheduler --add --interval monthly --day-of-month 10
* To schedule a weekly mysql-zrm run on Tuesday and  Wednesday:


To query mysql-zrm scheduled runs:
$ mysql-zrm-scheduler --add -interval weekly --day-of-week 2-3


# mysql-zrm-scheduler --query
* To schedule a monthly mysql-zrm run on the tenth day of each month:
  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 which has specific start time from schedule:
$ mysql-zrm-scheduler    --add    --interval  monthly --day-of-month  10


# mysql-zrm-scheduler  --delete  --interval  daily --start 13:35
* 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 the weekly mysql-zrm run from schedule:
* To delete a daily mysql-zrm run with specific start time:


  # mysql-zrm-scheduler --delete --interval weekly --day-of-week 2-3
  mysql-zrm-scheduler --delete --interval daily --start 08:20


==FILES==
==FILES==
     
 
; /var/lib/mysql-zrm : Directory under which all backup data is stored.
; /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 tool.
; /etc/mysql-zrm/backup set name/mysql-zrm.conf : Configuration file read by mysql-zrm utility.


==RETURN VALUES==
==RETURN VALUES==
Line 105: Line 100:
==SEE ALSO==
==SEE ALSO==


[[mysql-zrm]](1), [[mysql-zrm.conf]](5), [[mysql-zrm-reporter]](1), mysql(1), [[Zmanda_Recovery_Manager_for_MySQL|Zmanda Recovery Manager for  MySQL]].
[[mysql-zrm]](1), [[mysql-zrm-backup]](1), [[mysql-zrm-manage-backup]](1), [[mysql-zrm-restore]](1), [[mysql-zrm-check]](1), [[mysql-zrm-list]](1), [[mysql-zrm-getconf]](1), [[mysql-zrm-setconf]](1), [[mysql-zrm-parse-binlogs]](1), [[mysql-zrm-purge]](1), [[mysql-zrm-extract-backup]](1), [[mysql-zrm-verify-backup]](1), [[mysql-zrm-abort-backup]](1), [[mysql-zrm.conf]](5), [[mysql-zrm-reporter]](1), mysql(1)


==AUTHOR==
==AUTHOR==


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

Latest revision as of 21:46, 26 November 2008

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 level]
                    [--backup-set backupset name]
                    [--help]

DESCRIPTION

mysql-zrm-scheduler is the utility for ZRM for MySQL used to schedule MySQL backups using mysql-zrm-backup(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. If no pre-scheduler plugin exists, it will directly run the backup.

mysql-zrm-scheduler also implements the backup retention policy and purges backup files. By default, the backup image purge action will be performed at 4:00am daily. See mysql-zrm-backup(1) --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 based on the time specified by other options.
--delete
Delete a scheduled backup run. Use the --start option to delete a scheduled run with specific time.
--query
Display 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 Level
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 interval.
--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=Satur- day), 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

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-backup(1), mysql-zrm-manage-backup(1), mysql-zrm-restore(1), mysql-zrm-check(1), mysql-zrm-list(1), mysql-zrm-getconf(1), mysql-zrm-setconf(1), mysql-zrm-parse-binlogs(1), mysql-zrm-purge(1), mysql-zrm-extract-backup(1), mysql-zrm-verify-backup(1), mysql-zrm-abort-backup(1), mysql-zrm.conf(5), mysql-zrm-reporter(1), mysql(1)

AUTHOR

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