PerconaXtrabackup 压缩备份集
来源:互联网 发布:淘宝卖家登录界面 编辑:程序博客网 时间:2024/06/06 07:31
压缩备份集
stream模式支持且只支持:tar 和 xbstream 两种格式,后者是xtrabackup提供的专有格式,解包时需要同名的专用命令处理
innobackupex --defaults-file=/data/mysqldata/3306/my.cnf --user=backup --password='backup' --stream=tar /tmp | gzip -> /data/mysqldata/backup/xtra_full.tar.gzinnobackupex: Created backup directory /tmp这段信息表明,流格式标准输出的数据会被临时保存到我们指定的/tmp目录innobackupex: You must use -i (--ignore-zeros) option for extraction of the tar stream.最后这条提示我们,解包时必须使用-i参数[mysql@master backup]$ du -sh *2.8G 2015-07-07_17-11-0314M xtra_full.tar.gz打包压缩后的差距是很大的
mkdir xbstreaminnobackupex --defaults-file=/data/mysqldata/3306/my.cnf --user=backup --password='backup' --stream=xbstream ./ > /data/mysqldata/backup/xbstream/incremental.xbstream解包[mysql@master backup]$ cd xbstream/[mysql@master xbstream]$ xbstream -x < incremental.xbstream[mysql@master xbstream]$ lsbackup-my.cnf ibdata1 mysql sakila xtrabackup_binlog_info xtrabackup_infofandb incremental.xbstream performance_schema test xtrabackup_checkpoints xtrabackup_logfile
Incremental Streaming Backups using xbstream and tar Incremental streaming backups can be performed with the xbstream streaming option. Currently backups are packed in custom xbstream format. With this feature taking a BASE backup is needed as well.
Taking a base backup:
innobackupex /data/backups
Taking a local backup:
innobackupex –incremental –incremental-lsn=LSN-number –stream=xbstream ./ > incremental.xbstream
Unpacking the backup:
xbstream -x < incremental.xbstream
Taking a local backup and streaming it to the remote server and unpacking it:
innobackupex --incremental --incremental-lsn=LSN-number --stream=xbstream ./ | /ssh user@hostname " cat - | xbstream -x -C > /backup-dir/"
测试:
[mysql@master xbstream]$ xbstream -x -v < incremental.xbstream[mysql@master xbstream]$ lsbackup-my.cnf ibdata1 mysql sakila xtrabackup_binlog_info xtrabackup_infofandb incremental.xbstream performance_schema test xtrabackup_checkpoints xtrabackup_logfile[mysql@master xbstream]$ more xtrabackup_checkpoints backup_type = full-backupedfrom_lsn = 0to_lsn = 143684677last_lsn = 143684677compact = 0recover_binlog_info = 0
官方文档示例有问题,最后改成这样:
innobackupex --defaults-file=/data/mysqldata/3306/my.cnf --user=backup --password='backup' --incremental --incremental-lsn=143684677 --stream=xbstream ./ | ssh mysql@192.168.255.202 " xbstream -x -C /data/mysqldata/backup/"远程端:[mysql@slave backup]$ lsbackup-my.cnf ibdata1.delta mysql sakila xtrabackup_binlog_info xtrabackup_infofandb ibdata1.meta performance_schema test xtrabackup_checkpoints xtrabackup_logfile
Compact Backups
当备份innodb表时,可以忽略secondary index pages.这回缩小备份集的大小.负面影响是,这回增加prepare用时,因为要重建secondary index
Compact Backups需开启innodb-file-per-table
innobackupex --defaults-file=/data/mysqldata/3306/my.cnf --user=backup --password='backup' --compact /data/mysqldata/backup/
查看xtrabackup_checkpoints可以看到compact = 1
[mysql@master 2016-08-22_22-50-51]$ more xtrabackup_checkpoints backup_type = full-backupedfrom_lsn = 0to_lsn = 143789687last_lsn = 143789687compact = 1recover_binlog_info = 0
Preparing Compact Backups
prepare compact backup需要指定 –reduild-indexes参数
innobackupex --apply-log --rebuild-indexes /data/mysqldata/backup/2016-08-22_22-50-51/
Restoring Compact Backups
innobackupex --copy-back /path/to/BACKUP-DIR
- PerconaXtrabackup 压缩备份集
- PerconaXtraBackup --全备增备prepare restore
- 关于压缩的备份集---compressed backupset
- [LINUX] 备份压缩
- 备份与压缩
- 备份和压缩指令
- ORACLE备份中的压缩
- SQL Server 备份压缩
- 自动压缩备份数据库
- Linux_压缩及其备份
- oracle定时备份压缩
- Widnows定时压缩备份
- 备份与压缩
- Linux备份压缩命令
- 压缩与备份
- 文件压缩和备份
- linux压缩,备份,还原
- 数据库压缩备份|还原
- 最长回文子串
- 1022. Digital Library (30)-PAT甲级真题(map映射)
- HDU 5860 Death Sequence (递推 + 约瑟夫环 + 思维)——2016 Multi-University Training Contest 10
- Spring从入门到精通(一)----IoC(控制反转)
- UVa 1428 Ping pong (树状数组)
- PerconaXtrabackup 压缩备份集
- iptables学习
- SpringIOC--初始化源码解析
- HDOJ 2066 一个人的旅行(最短路)
- 求两个二进制数的最大公约数
- 初窥 CATransform3D 文档解读
- 计算机网络问题总结
- itoo在线编辑学习——nignx
- POJ 3687 Labeling Balls