MySQL xtrabackup backup recovery implementation sharing _mysql
Source: Internet
Author: User
Brief Introduction Xtrabackup is the MySQL database Backup tool provided by Percona, according to the official, this is also the world's only one by one open source to be able to the InnoDB and XTRADB database hot standby tool. Characteristics:
(1) The backup process is fast and reliable;
(2) The backup process does not interrupt the transaction under execution;
(3) Can save disk space and flow based on the function of compression;
(4) Automatically realize the backup test;
(5) The reduction speed is fast;
The xtrabackup contains two tools:
* Xtrabackup-For hot backup innodb, XTRADB table Tools, cannot back up other tables.
* Innobackupex-Provides the ability to MyISAM table backups for Perl scripts in Xtrabackup encapsulation. (Can perform whole library and datasheet backup).
When using a Innobakupex backup, it invokes Xtrabackup to back up all innodb tables, copying all relevant files (. frm) about the table structure definition, and related files for the MyISAM, MERGE, CSV, and archive tables.
It also backs up files related to triggers and database configuration information. These files are saved to a time-ordered directory.
At the same time as the backup, Innobackupex also creates the following files in the backup directory:
(1) xtrabackup_checkpoints--backup type (such as full or incremental), backup status (such as whether it is already prepared state) and LSN (log sequence number) range information; each InnoDB page (typically 16k size) contains a log sequence number, That is the LSN. LSN is the system version number of the entire database system, and each page-related LSN can indicate how the page has changed recently.
(2) The binary log file that the Xtrabackup_binlog_info--mysql server is currently using, and the location of the binary log event until this moment of backup.
(3) xtrabackup_binlog_pos_innodb--binary log files and the current position of binary log files for InnoDB or xtradb tables.
(4) The Xtrabackup executable file used in xtrabackup_binary--backup;
(5) backup-my.cnf--The configuration option information used by the backup command;
When you use Innobackupex for backup, you can also use the--NO-TIMESTAMP option to prevent a command from automatically creating a time-named directory; the Innobackupex command creates a Backup-dir directory to store the backup data.
Binary version http://www.percona.com/downloads/XtraBackup/
wget http://www.percona.com/downloads/XtraBackup/LATEST/binary/Linux/x86_64/percona-xtrabackup-2.0.3-470.tar.gz
Tar zxvf percona-xtrabackup-2.0.3-470.tar.gz
CD Percona-xtrabackup-2.0.3/bin
CP */usr/bin/
This time using the mysql5.5.28 installation is not described here
Build a directory for data backup
Mkdir-p/opt/mysql_bak/
Modifying a database configuration file:
Vim/etc/my.cnf
DataDir =/home/mysql/data/
Mysqladmin-uroot Password 123456
Whole Library Backup: Innobackupex--user=root--password=123456--defaults-file=/etc/my.cnf/opt/mysql_bak/
Separate backups: Innobackupex--user=root--password=123456--defaults-file=/etc/my.cnf--database=test/opt/mysql_bak
Backup and package compression:
Innobackupex--user=root--password=123456--defaults-file=/etc/my.cnf--database=test--stream=tar/opt/mysql_bak/| gzip >/opt/mysql_bak/testdb.tar.gz
with time stamp Innobackupex--user=root--password=123456--defaults-file=/etc/my.cnf--database=test--stream=tar/opt/mysql_bak/| gzip >/opt/mysql_bak/' Date +%f ' _testdb.tar.gz
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service