Mysql-zrm-scheduler: Difference between revisions

From wiki.zmanda.com
Jump to navigation Jump to search
No edit summary
 
(13 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 <start time>]
                    [--start-time start time]
                    [--interval <interval>]
                    [--day-of-week day of week]
                    [--backup-level <0|1>]
                    [--day-of-month day of month]
                    [--backup-set <backupset name>]
                    [--interval interval]
                    [--help]
                    [--backup-level level]
                    [--backup-set backupset name]
                    [--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.


During the first time this tool is used to add a MySQL backup, it will also schedule a [[mysql-zrm]] purge action to purge mysql-zrm backup files based on retention policy for the backup set. The purge action will take place at 4am daily. See mysql-zrm [[Mysql-zrm#OPTIONS|retention-policy]] for details.
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.


If ''--now''  option is specified,  the mysql-zrm-scheduler tool will call [[mysql-zrm]] immediately.
When --now option is specified,  the   mysql-zrm-scheduler utility will run mysql-zrm immediately.


== OPTIONS ==
==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.
; --add  : Add  a   mysql-zrm  backup   run to the schedule based on the time specified by other options.


; --query : Displays list of backup runs scheduled.
; --delete : Delete a scheduled backup run. Use the --start  option to  delete a scheduled run with specific time.


; --interval <interval> : Valid inputs are daily, weekly or monthly.
; --query : Display a list of backup runs scheduled.


; --now : Does MySQL backup now.
; --interval interval : Valid  options  are  daily, weekly or monthly. Default: weekly


; --backup-set <name> : Specify the backup set for the backup run. Default is BackupSet1.
; --now : Immediately do the backup of MySQL.


; --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-set name : Specify the backup set name for the backup run. Default is BackupSet1.


; --start <start time> : time  in  HH:MM  format. Default: 00:00 for monthly, 02:00 for weekly and 03:00 for daily.
; --backup-level Level : Choose  0 for full backup. Choose 1 for  an  incremental backup. Default is 0.


; --help : Display help message and exit.
; --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==
==EXAMPLES==


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


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


To schedule a daily mysql-zrm run on 1:35pm:
* To schedule a weekly mysql-zrm run on Tuesday and  Wednesday:


  # mysql-zrm-scheduler --add -interval daily --start 13:35
  $ mysql-zrm-scheduler --add -interval weekly --day-of-week 2-3


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


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


To delete a weekly mysql-zrm run from schedule:
* To query scheduled runs:


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


  # mysql-zrm-scheduler  --delete  --interval weekly --start 08:20
  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 74: Line 100:
==SEE ALSO==
==SEE ALSO==


[[mysql-zrm]](1), [[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)