一、备份策略
1.周日全备份,周一至周六增量备份
2.全备份目录
/u03/backup/innobackup/full_backup
3.增量备份目录
/u03/backup/innobackup/incremental_1
/u03/backup/innobackup/incremental_2
/u03/backup/innobackup/incremental_3
/u03/backup/innobackup/incremental_4
/u03/backup/innobackup/incremental_5
/u03/backup/innobackup/incremental_6
4.备份的采用innobackupex的 --compress参数进行压缩
1.周日全备份,周一至周六增量备份
2.全备份目录
/u03/backup/innobackup/full_backup
3.增量备份目录
/u03/backup/innobackup/incremental_1
/u03/backup/innobackup/incremental_2
/u03/backup/innobackup/incremental_3
/u03/backup/innobackup/incremental_4
/u03/backup/innobackup/incremental_5
/u03/backup/innobackup/incremental_6
4.备份的采用innobackupex的 --compress参数进行压缩
二、备份并压缩
1.周日全库备份
innobackupex --user=root --password=oracletest --compress /u03/backup/innobackup/full_backup
备份得到2017-04-26_15-47-05
1.周日全库备份
innobackupex --user=root --password=oracletest --compress /u03/backup/innobackup/full_backup
备份得到2017-04-26_15-47-05
2.周一增量备份,此增量是基于周日的全备份
innobackupex --user=root --password=oracletest --incremental-basedir=/u03/backup/innobackup/full_backup/2017-04-26_15-47-05/ --compress --incremental /u03/backup/innobackup/incremental_1/
备份得到2017-04-26_15-51-56
innobackupex --user=root --password=oracletest --incremental-basedir=/u03/backup/innobackup/full_backup/2017-04-26_15-47-05/ --compress --incremental /u03/backup/innobackup/incremental_1/
备份得到2017-04-26_15-51-56
3.周二增量备份,此增量是基于周一的增量备份
innobackupex --user=root --password=oracletest --incremental-basedir=/u03/backup/innobackup/incremental_1/2017-04-26_15-51-56/ --compress --incremental /u03/backup/innobackup/incremental_2/
备份得到2017-04-26_15-53-55
innobackupex --user=root --password=oracletest --incremental-basedir=/u03/backup/innobackup/incremental_1/2017-04-26_15-51-56/ --compress --incremental /u03/backup/innobackup/incremental_2/
备份得到2017-04-26_15-53-55
4.周三至周六以此类推
。。。。。。
三、解压缩
1.解压缩全备份
#innobackupex --decompress /u03/backup/innobackup/full_backup/2017-04-26_16-18-40/
for i in `find ./ -iname "*.qp"`; do qpress -d $i $(dirname $i) && rm -rf $i;done
2.解压缩周一增量备份
#innobackupex --decompress /u03/backup/innobackup/incremental_1/2017-04-26_15-51-56
for i in `find ./ -iname "*.qp"`; do qpress -d $i $(dirname $i) && rm -rf $i;done
#innobackupex --decompress /u03/backup/innobackup/incremental_1/2017-04-26_15-51-56
for i in `find ./ -iname "*.qp"`; do qpress -d $i $(dirname $i) && rm -rf $i;done
3.解压缩周二增量备份
#innobackupex --decompress /u03/backup/innobackup/incremental_2/2017-04-26_15-53-55
for i in `find ./ -iname "*.qp"`; do qpress -d $i $(dirname $i) && rm -rf $i;done
#innobackupex --decompress /u03/backup/innobackup/incremental_2/2017-04-26_15-53-55
for i in `find ./ -iname "*.qp"`; do qpress -d $i $(dirname $i) && rm -rf $i;done
4.周三至周六以此类推
四、恢复
1.应用全备份日志
innobackupex --apply-log --redo-only /u03/backup/innobackup/full_backup/2017-04-26_15-47-05
2.应用周一增量备份日志
innobackupex --apply-log --redo-only /u03/backup/innobackup/full_backup/2017-04-26_15-47-05 --incremental-dir=/u03/backup/innobackup/incremental_1/2017-04-26_15-51-56
innobackupex --apply-log --redo-only /u03/backup/innobackup/full_backup/2017-04-26_15-47-05 --incremental-dir=/u03/backup/innobackup/incremental_1/2017-04-26_15-51-56
3.应用周二增量备份日志(如果恢复到周二的数据,那么在应用周二增量备份日志的时候,不要加上--redo-only参数)
innobackupex --apply-log /u03/backup/innobackup/full_backup/2017-04-26_15-47-05 --incremental-dir=/u03/backup/innobackup/incremental_2/2017-04-26_15-53-55
innobackupex --apply-log /u03/backup/innobackup/full_backup/2017-04-26_15-47-05 --incremental-dir=/u03/backup/innobackup/incremental_2/2017-04-26_15-53-55
4.周三至周六以此类推
五、将数据copy回相应目录
1.回滚未完成的日志
innobackupex --apply-log
2.将数据copy回相应目录
innobackupex /u03/backup/innobackup/full_backup/2017-04-26_15-47-05
innobackupex /u03/backup/innobackup/full_backup/2017-04-26_15-47-05
3.恢复数据所有者
chown mysql. *
chown mysql. *
六、开启数据库验证