The Percona TokuBackup library intercepts system calls that write files and duplicates the writes on backup files. It does this while copying files to the backup directory.
The following technical issues must be addressed to get Percona TokuBackup working with MySQL:
The TokuBackup library must be loaded into the mysqld server so that it can intercept system calls. We use LD_PRELOAD to solve the system call intercept problem. Alternatively, the hot backup library can be linked into mysqld.
There must be a user interface that can be used to start a backup, track its progress, and determine whether or not the backup succeeded. We use a plugin that kicks off a backup as a side effect of setting a backup session variable to the name of the destination directory.
Installing the Percona TokuBackup libraries
1 Extract the tarball
2 Copy tokudb_backup.so to MySQL's plugin directory
3 Copy libHotBackup.so to MySQL's lib directory
4 Run mysqld with the TokuBackup library (should exist in the lib directory)
NOTE: The preload is NOT necessary for MySQL and MariaDB builds from Percona since we link the TokuBackup library into mysqld already.
5 Install the TokuBackup plugin (should exist in the MySQL plugin directory)
install plugin tokudb_backup soname 'tokudb_backup.so';
Running a backup
Backup to the '/tmp/backup1047' directory. This blocks until the backup is complete.
set tokudb_backup_dir statement will succeed if the backup was taken. Otherwise, the
tokudb_backup_last_error variable is set.
select @@tokudb_backup_last_error, @@tokudb_backup_last_error_string;
Excluding source files
Lets suppose that you want to exclude all 'lost+found' directories from the backup. The
tokudb_backup_exclude session variable contains a regular expression that all source file names are compared with. If the source file name matches the exclude regular expression, then the source file is excluded from the backup.
Percona TokuBackup updates the processlist state with progress information while it is running.
Throttling the backup write rate
tokudb_backup_throttle variable imposes an upper bound on the write rate of the TokuDB backup. Units are bytes per second. Default is no upper bound.
- comment:version of the TokuBackup plugin
- comment:version of the TokuBackup library
- comment:allowed prefix of the destination directory
- comment:backup throttle on write rate in bytes per second
- comment:name of the directory where the backup is stored
- comment:error from the last backup. 0 is success
- comment:error string of the last backup
- comment:exclude source file regular expression
Building the Percona TokuBackup plugin from source
TokuBackup is now part of Percona Server. For information about building Percona Server, refer to the corresponding documentation at https://www.percona.com/doc/percona-server/5.6/installation.html#compiling-percona-server-from-source.