Percona5.7 TokuBackup支持TokuDB熱備份mysql
1、安裝tokudb引擎sql
執行如下腳本,自動安裝tokudb。bash
# bin/ps-admin --defaults-file=/etc/my3308.cnf --enable -uroot -p123456 -S /tmp/mysql3308.sock Checking SELinux status... INFO: SELinux is disabled. Checking if TokuDB plugin is available for installation ... INFO: ha_tokudb.so library for TokuDB found at /usr/local/Percona/lib/mysql/plugin/ha_tokudb.so. Checking location of jemalloc library ... INFO: jemalloc library needed for TokuDB found at /usr/local/Percona/lib/mysql/libjemalloc.so.1 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 TokuDB engine plugin status... INFO: TokuDB engine plugin is installed. Adding thp-setting=never option into /etc/my3308.cnf INFO: Successfully added thp-setting=never option into /etc/my3308.cnf
2、增長mysqld_safe啓動參數preload-hotbackup至my.cnf配置文件裏異步
# bin/ps_tokudb_admin --defaults-file=/etc/my3308.cnf --enable-backup -uroot -p123456 -S /tmp/mysql3308.sock WARNING: This script is deprecated and will be removed in 8.0. You can use ps-admin script which has more functionality. 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 set in the config file. Checking if preload-hotbackup option is already set in config file... INFO: Option preload-hotbackup is not 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. Adding preload-hotbackup option into /etc/my3308.cnf INFO: Successfully added preload-hotbackup option into /etc/my3308.cnf PLEASE RESTART MYSQL SERVICE AND RUN THIS SCRIPT AGAIN TO FINISH INSTALLATION!
3、重啓mysqld服務ide
/etc/init.d/mysql restart
4、安裝熱備份TokuBackup plugin工具插件工具
# bin/ps_tokudb_admin --defaults-file=/etc/my3308.cnf --enable-backup -uroot -p123456 -S /tmp/mysql3308.sock WARNING: This script is deprecated and will be removed in 8.0. You can use ps-admin script which has more functionality. 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 set in the config file. 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. Installing TokuBackup plugin... INFO: Successfully installed TokuBackup plugin.
5、開始全量熱備份spa
執行下面的命令便可開啓熱備份:
插件
MySQL [(none)]> set tokudb_backup_dir='/data/tokudb_bak/'; Query OK, 0 rows affected (0.408 sec)
注:建立一個空目錄/data/tokudb_bak,並將其屬性改爲mysqlrest
注意事項:進程
一、關閉異步IO,不然備份失敗。
innodb_use_native_aio = 0
二、不支持增量備份
6、恢復
直接拷貝備份文件至你的數據目錄下,啓動mysqld進程便可。