xtrabackup 备份原理

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xtrabackup 备份原理相关的知识,希望对你有一定的参考价值。

xtraback是物理备份,非阻塞在线实时备份
1.优点:

  • 备份速度很快
  • 备份期间不中断事务
  • 通过压缩节约网络和磁盘
  • 自动备份验证
  • 恢复快

官网提示:

  • Fast and reliable backups
  • Uninterrupted transaction processing during backups
  • Savings on disk space and network bandwidth with better compression
  • Automatic backup verification
  • Higher uptime due to faster restore time

2.备份原理
xtrabackup 会有两个线程,当copy InnoDB的data files时,同时会在后台再开一个线程用来copy redo log(有变化的)
当数据库支持备份时,xtrabackup 将会第一时间先备份InnoDB data,执行LOCK TABLES FOR BACKUP 来copy非事务表和.frm 文件。当这些完成以后,就会备份 .frm, .MRG, .MYD, .MYI, .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV, .par, and .opt files.
然后xtrabackup 会用 LOCK BINLOG FOR BACKUP 来防止改变二进制日志位置的操作。随后会完成二进制日志复制并记录位置。copy完成后,便会释放所有的锁
最后,二进制日志被记录,xtrabackup 正常退出返回0

原文
Percona XtraBackup will use Backup locks where available as a lightweight alternative to FLUSH TABLES WITH READ LOCK. This feature is available in Percona Server 5.6+. Percona XtraBackup uses this automatically to copy non-InnoDB data to avoid blocking DML queries that modify InnoDB tables. When backup locks are supported by the server, xtrabackup will first copy InnoDB data, run the LOCK TABLES FOR BACKUP and copy the MyISAM tables and .frm files. Once this is done, the backup of the files will begin. It will backup .frm, .MRG, .MYD, .MYI, .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV, .par, and .opt files
After that xtrabackup will use LOCK BINLOG FOR BACKUP to block all operations that might change either binary log position or Exec_Master_Log_Pos or Exec_Gtid_Set (i.e. master binary log coordinates corresponding to the current SQL thread state on a replication slave) as reported by SHOW MASTER/SLAVE STATUS. xtrabackup will then finish copying the REDO log files and fetch the binary log coordinates. After this is completed xtrabackup will unlock the binary log and tables.

Finally, the binary log position will be printed to STDERR and xtrabackup will exit returning 0 if all went OK.

以上是关于xtrabackup 备份原理的主要内容,如果未能解决你的问题,请参考以下文章

xtrabackup介绍及备份原理

xtrabackup备份原理

XtraBackup的备份原理与应用示例

xtrabackup备份原理

XtraBackup原理解读

xtrabackup原理及用法详解