Ganeti Backup Scheduler

Marco Casavecchia M.

Ganeti Backups Scheduler

Preface

The new Backup scheduler is a command-line tool that will help you to automatically plan and execute the daily backups of your precious Virtual Machines.
It uses a simple algorithm to spread the backups in a few days trying to balance the amount of data to save for each day in order obtain similar backup durations for each run.

How it works

The scheduler can plan daily, weekly and monthly backups following this logic:
* instances that needs daily backups are made every day.
* instances that needs weekly backups are made a few per day in order to split up the job in 7 days tying to balance the amount of data to backup for each day.
* instances that needs monthly backups are made every sunday with the same logic of the weekly approach.

How to set it up

You need to copy the ganeti-bkscheduler crontab file into the "/etc/cron.d" directory of all the master-candidate nodes of your cluster.
This file will run the scheduler everyday at the 1:00 AM.

Then you have to "generate" the new backup plan by running a single command on the master node:
gnt-bkscheduler.sh reschedule

This command will run for a while depending by the number of VM on your cluster and in the end it will show you the calculated backups plan asking you to confirm the scheduling.
Once that you accepted the schedule you're done, the scheduler will execute the backups as it promised.

NOTE: If you do not set any tag or OS parameter for your VMs it will assume that you want to do weekly backups in cold mode of the primary disk (disk 0) of instances. if you need to change the schedule or kind of backup for some instances, just add to them the appropriate [Os Parameters and Instance Tags] and then run again the scheduler in reschedule mode adding the modified instance as parameters.
In this way the scheduler will only reschedule the selected instance without modify the already planned backups.
For exmaple: gnt-bkscheduler.sh reschedule my.daily.instance my.monthly.instance ..

Scheduler Commands

The scheduler can be also used to list and check the status of the schedules and execute manual backups.

The commands of gnt-bkscheduler.sh are:
* help -> Prints the usage of the command
* list ''instance/s'' -> lists the status of the instance/s specified: last backup, policy, next planned backup.. If no instance is specified it lists them all.
* list-$xxx -> using one of the following words in the place of $xxx you can ask to the scheduler to list what is planned for today (list-today), tomorrow (list-tomorrow), wednesday (list-wednesday), and so on..
* run -> executes the backups planned for today
* dry-run -> simulates the backup operations for today but doesn't do anything.
* manual ''instance/s'' -> executes the manual backup of the specified instance/s even if it's not planned for today.
* reschedule ''instance/s'' -> Calculates a new schedule for the specified instance/s. If no instance is passed it calculates the schedules for all the instances.
* simulate-reschedule ''instance/s'' -> same as the reschedule but doesn't makes any changes.
* force-$xxx -> forces the next backup to be done on the specified date. Accepts the same values of the list-$xxx command except of "yesterday"


Related

Home: Home
Home: Os Parameters and Instance Tags