As a hotbackup tool of innodb, xtrabackup is developed by percona and widely deployed in mysql due to open source, hot backup, and physical backup.
As a hotbackup tool of innodb, xtrabackup is developed by percona and widely deployed in mysql due to open source, hot backup, and physical backup.
Xtrabackup, developed by percona as the hotbackup tool of innodb, is widely deployed in mysql due to open source, hot backup, and physical backup. The details can be found in the previous discussions.
MySQL management-using XtraBackup for Hot Backup
MySQL open-source backup tool Xtrabackup backup deployment
MySQL Xtrabackup backup and recovery
Use XtraBackup to implement MySQL master-slave replication and quick deployment [master-slave table lock-free]
Install and use Xtrabackup from Percona to back up MySQL
A major challenge for physical hot backup is inconsistent data blocks at the file level. we know that the size of a single page in innodb is determined by innodb_page_size, which is generally 16 K. consists of 4 K file systems.
Mysql> show global variables like 'innodb _ page_size ';
+ ------------------ + ------- +
| Variable_name | Value |
+ ------------------ + ------- +
| Innodb_page_size | 16384 |
+ ------------------ + ------- +
1 row in set (0.00 sec)
Because it is a hot backup, when the backup tool copies the innodb page, the database process may also be writing this page.
The page copied by the backup tool may be broken, also known as inconsistency between the beginning and end of the page or page breakage. this is why common OS replication tools cannot be used as physical Hot Backup tools for databases.
Let's take a look at how the xtrbackup tool solves this problem. at the beginning of the backup, xtrabackup will copy all innodb pages like normal copy tools, so there will also be page breakage problems. When the backup starts, xtrabackup generates another thread to copy the transaction logs of the current innodb, and monitors the transaction log files of innodb at the same time. Once a new transaction log of innodb is generated, it will also be written to xtrabckup's own log.
After the backup is complete, xtrabacup returns a page-breaking data file and transaction logs of all innodb during the backup. at this time, the results of the mysql instance crash are the same (the data file is incomplete after the instance crashes, and the transaction log is complete ). xtrabackup also requires a process called prepare, which is basically the same as what is done after the mysql instance crashes. Use bad data files and transaction logs for rollback and forward operations.
Xtrabckup itself links to innodb-related libraries. In the prepare stage, we can see innodb startup and shutdown information, which is similar to the standard mysql instance startup and shutdown processes, in essence, xtrabackup calls innodb-related code to restore the instance during prepare. after prepare, The xtrabackup backup file is a consistent copy of data and can be directly used to start mysql.
We can see that xtrabackup uses the transaction log of innodb to restore the instance and obtain consistent backup. non-innodb tables cannot be used because there is no transaction log. therefore, we can see that in xtrackup, The Myisam Table backup still requires a read-only table lock to lock the table, and then back up the data file, which is no different from the normal copy tool.
XtraBackup details: click here
XtraBackup: click here