TokuDB is a high compression Engine for MySQL. It uses Fractal tree pages and huge data pages to achieve the
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 TokuBackup library must be installed into the mysqld server to use it. It comes with the default installation of Percona servers ( not activated ).
- The process of backup and the details about the destination directory can viewed be in processlist.
- We will start will installation of tokubackup [ Hot Backup ].
Installing Backup Tool.
ps_tokudb_admin --enable-backup Checking SELinux status... INFO: SELinux is disabled. Checking if Percona Server is running with jemalloc enabled... INFO: Percona Server is running with jemalloc enabled. Checking transparent huge pages status on the system... INFO: Transparent huge pages are currently disabled on the system. Checking if thp-setting=never option is already set in config file... INFO: Option thp-setting=never is not set in the config file. (needed only if THP is not disabled permanently on the system) Checking if preload-hotbackup option is already set in config file... INFO: Option preload-hotbackup is set in the config file. Checking TokuDB engine plugin status... INFO: TokuDB engine plugin is installed. Checking TokuBackup plugin status... INFO: TokuBackup plugin is not installed. Checking if Percona Server is running with libHotBackup.so preloaded... INFO: Percona Server is running with libHotBackup.so preloaded. Adding thp-setting=never option into /etc/my.cnf INFO: Successfully added thp-setting=never option into /etc/my.cnf Installing TokuBackup plugin... INFO: Successfully installed TokuBackup plugin
After installing the plugin validate it inside MySQL
mysql> select plugin_name `Plugin Name`,plugin_status `Status`,plugin_library `Library` from information_schema.plugins where plugin_name like 'tokudb_backup'; +---------------+--------+------------------+ | Plugin Name | Status | Library | +---------------+--------+------------------+ | tokudb_backup | ACTIVE | tokudb_backup.so | +---------------+--------+------------------+
Initializing the backup:
mysql> set global tokudb_backup_dir='/home/mydbops/backup_dir/'; Query OK, 0 rows affected (58.82 sec)
Check the backup process in processlist:
mysql> show processlist\G *************************** 1. row *************************** Id: 2 User: root Host: localhost db: NULL Command: Query Time: 35 State: tokudb backup about 39% done: Backup progress 105271233 bytes, 381 files. Copying file: 15728640/50331648 bytes done of /var/lib/mysql/ib_logfile0 to /home/mydbops/backup_dir/mysql_data_dir/ib_logfile0. Info: set global tokudb_backup_dir='/home/mydbops/backup_dir/' Rows_sent: 0 Rows_examined: 0
If you have enabled both data_dir and tokudb_data_dir in cnf file it will take the backup of both data directory.
If you have enabled only tokudb_data_dir in cnf file it will have only that data_dir file as backup.
Restoring the backup:
Restoring the backup is simple.
- Stop the percona server.
- Move the backup directory (/home/mydbops/backup_dir/tokudb_data_dir/) into data directory (/var/lib/mysql/).
- Make sure of the permission in data directory as mysql.
- Start the Percona server.
- If you are using TokuDB engine have to use mysqldump or any other backup tool (mydumper,mysqlpump).
- The TokuDB engine doesn’t support xtrabackup.
- Toku backup does not have any other forms like incremental backup or partial backup.
- The Point in time recovery is possible if we have noted the binary log and its position.It can be automated by designing a good backup program.