利用xtrabackup 全量备份的mysql5.6.40实例的100G的数据恢复MySQL5.7.24实例上到单实例消耗的时间:
服务器的环境如下:
dell r620 双颗CPU,单核心是12核心,内存是72G ,硬盘伪sata接口的企业级的SSD固态硬盘:500G
固态盘型号如下:
PD Type: SATA
Raw Size: 465.761 GB [0x3a386030 Sectors]
Inquiry Data: S3Z3NB0K116201W Samsung SSD 860 EVO 500GB RVT01B6Q
Device Speed: 6.0Gb/s
消耗时间测试演示如下:
[root@e ~]# time innobackupex --apply-log /data/backup/db_3306_20190812
InnoDB: Shutdown completed; log sequence number 143003422760
190815 16:53:30 completed OK!
real 0m13.475s
user 0m0.445s
sys 0m3.182s
[root@e db_3306_20190812]# time innobackupex --defaults-file=/data/mysql5.7/my3306.cnf --copy-back /data/backup/db_3306_20190812/
190815 17:12:06 [01] Copying ./ib_buffer_pool to /data/mysql5.7/3306/data/ib_buffer_pool
190815 17:12:06 [01] ...done
190815 17:12:06 [01] Copying ./xtrabackup_info to /data/mysql5.7/3306/data/xtrabackup_info
190815 17:12:06 [01] ...done
190815 17:12:06 [01] Copying ./xtrabackup_binlog_pos_innodb to /data/mysql5.7/3306/data/xtrabackup_binlog_pos_innodb
190815 17:12:06 [01] ...done
190815 17:12:06 [01] Copying ./xtrabackup_master_key_id to /data/mysql5.7/3306/data/xtrabackup_master_key_id
190815 17:12:06 [01] ...done
190815 17:12:06 [01] Copying ./ibtmp1 to /data/mysql5.7/3306/data/ibtmp1
190815 17:12:06 [01] ...done
190815 17:12:06 completed OK!
real 12m55.410s
user 0m0.476s
sys 3m56.766s
授权 /data/mysql5.7/3306/data 目录mysql权限:
[root@e 3306]# chown -R mysql.mysql /data/mysql5.7/3306/data
启动mysql
[root@e db_3306_20190812]# /usr/local/mysql5.7/bin/mysqld --defaults-file=/data/mysql5.7/my3306.cnf &
数据恢复完成:
[root@e binlog]# mysql -uroot -p'lnmp.org#25199' -S /tmp/3306.sock -e "show databases;"|grep testdb
Warning: Using a password on the command line interface can be insecure.
testdb01
testdb02
.。。。。。
testdb06
testdb07
testdb08
从恢复到启动mysql新实例 整个执行过程消耗的时间不到14分钟。相比较mysql自身的mysqldump工具,xtrabackup备份和恢复数据库的效率是远远高于mysqldump 的。
备份特别大的数据时,xtrabackup是首推的备份工具