(5)innobackupex收到xtrabackup通知后哦,執行FLUSH TABLES WITH READ LOCK(FTWRL),取得一致性位點,然后開始備份非InnoDB文件(如frm、MYD、MYI、CSV、opt、par等格式的文件),在拷貝非InnoDB文件的過程當中,數據庫處於全局只讀狀態。
mysql> CREATE USER 'bkpuser'@'localhost' IDENTIFIED BY '123456'; #創建用戶 mysql> REVOKE ALL PRIVILEGES,GRANT OPTION FROM 'bkpuser'; #回收此用戶所有權限 mysql> GRANT RELOAD,LOCK TABLES,RELICATION CLIENT ON *.* TO 'bkpuser'@'localhost'; #授權刷新、鎖定表、用戶查看服務器狀態 mysql> FLUSH PRIVILEGES; #刷新授權表
IMPORTANT: Please check that the apply-log run completes successfully. At the end of a successful apply-log run innobackupex prints "completed OK!".
innobackupex version 2.4.9 based on MySQL server 5.7.13 Linux (x86_64) (revision id: a467167cdd4) xtrabackup: cd to /backups/2018-07-30_11-01-37/ xtrabackup: This target seems to be not prepared yet. InnoDB: Number of pools: 1 xtrabackup: xtrabackup_logfile detected: size=8388608, start_lsn=(3127097) ...... InnoDB: FTS optimize thread exiting. InnoDB: Starting shutdown... InnoDB: Shutdown completed; log sequence number 3129915 180729 23:18:30 completed OK! [root@slave ~]# rm -rf /usr/local/mysql/data/ #在slave上刪除原有的數據 [root@slave ~]# vim /etc/my.cnf #配置my.cnf的數據目錄路徑,否則會報錯,要和master一致 datadir=/usr/local/mysql/data [root@slave ~]# innobackupex --copy-back /backups/2018-07-30_11-01-37/ #在slave上數據恢復 180729 23:32:03 innobackupex: Starting the copy-back operation
IMPORTANT: Please check that the apply-log run completes successfully. At the end of a successful apply-log run innobackupex prints "completed OK!".
innobackupex version 2.4.9 based on MySQL server 5.7.13 Linux (x86_64) (revision id: a467167cdd4) xtrabackup: cd to /backups/2018-07-30_11-01-37/ ...... ...... xtrabackup: starting shutdown with innodb_fast_shutdown = 1 InnoDB: Starting shutdown... InnoDB: Shutdown completed; log sequence number 3127106 InnoDB: Number of pools: 1 180730 14:05:29 completed OK!