Part of the Joyent Percona Instance is Joyent QuickBackup, a fast non-blocking MySQL backup service powered by Percona Xtrabackup on the back end. This service is pre-configured with the username and password but disabled by default. The only settings you need to configure are the minute, hour, day, and expiredays.
In this topic:
To configure the backup service, use the svccfg command to set the following values. By default, the service is set to backup every night at midnight
|Property||Description||Accepted Values||Default Value|
|quickbackup/username||MySQL user for QuickBackup||16 characters||qb-xxxxxxxx|
|quickbackup/password||MySQL password for QuickBackup||41 characters||xxxxxxxxxxx|
|quickbackup/minute||Minute of the hour to backup||0-60 comma separated or 'all'||0|
|quickbackup/hour||Hour of the day to backup||0-23 comma separated or 'all'||0|
|quickbackup/day||Day of the week to backup||sun-sat comma separated or 'all'||all|
|quickbackup/expiredays||Number of days to keep backups||1-255 or 'none'||3|
|quickbackup/databases||Name of databases to backup||dbname1,dbname2 or 'all'||all|
|quickbackup/backupdir||Name of directory to backup to||/directory||/backups|
|quickbackup/stream||Streaming method for Quickbackup to use||xbstream or tar||xbstream|
To see how properties are set for the service, use the svcprop command. For example:
To change a service property use the svccfg command. You specify which property you want to change and the value you want to set. For example, this command is setting the property value for the quickbackup/backupdir property:
When making a change to a Quickbackup property, you need to restart the service for the change to take effect:
You can then verify that your change was set correctly with svcprop.
The location of the backup and log files is different depending on which image version you are running.
|13.1.0 and later||1.6.0 and earlier|
By default, the service is set to back up every night at midnight. To set the service to perform a backup every 15 minutes of every hour Monday, Tuesday, Wednesday, Thursday, and Friday, you would use the following svccfg commands:
After setting the properties use the svcadm command to refresh and restart the service:
If the backup completed successfully you will see a confirmation message in the log like the following:
At the end of every backup, QuickBackup cleans up the old backup files and removes them if they are older than the value set for quickbackup/expiredays. It does this by checking the last modification time of the backup file.
Backups are stored in files named %Y-%m-%d_%H-%M-%S-backup.tar.gz. The backup files contain all of the databases by default or each database you specified in the quickbackup/databases setting.
See Backup Files and Log Files for the location of the log file.
To make a backup manually (not on a schedule) with QuickBackup you can call the script by its self.
After the backup it will rotate the backup files to quickbackup/expiredays set.
To restore a backup:
- Shut down the MySQL server:
- Indicate which backup you want to restore by passing in the path to the backup file:
If successful, you will see a confirmation message that the restore completed successfully
If there is an error, you will need to check the QuickBackup log file. See Backup Files and Log Files for the location of the log file.
Once the restore is complete, re-enable MySQL:
At this point, everything is running from the restored backup.
In Quickbackup version 3.0 (and later), you can select between two different streaming methods for performing a backup: tar and xbstream.
- Tar is the original method for Quickbackup. While it is much slower, it provides better compression.
- Xbstream is the new method. It is much faster but does not provide as good compression.
The default is now xbstream, but you can use either.
You can configure the streaming method by setting the value of the quickbackup/stream property. To change it:
|When doing a Quickbackup restore, you now need to specify the streaming method used for the backup from which you are trying to restore.|
Below is a comparison of the time it takes to perform a backup between 'tar' and 'xbstream' on a 10 GB dataset.