(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!