In the actual production environment to ensure that the online service is very important, so in peacetime back up the database is generally used in less time, and in MySQL has the default Backup tool Mysqldump, in the general scenario backup is not too much problem, Mysqldump This ancient tool is a backup of the data into SQL script, is a logical backup method, but the larger data backup or need to master from the synchronization of the backup when the mysqldump efficiency is very low (long time lock table, occupy a lot of system resources, Backing up a lot of data for a long time, and so on, so mysqldump in these special scenarios is not a good choice, so someone used Perl to write an open-source tool for backing up InnoDB and MyISAM engines--xtrabackup, Of course, after the 1.51 version in order to also be able to back up the MyISAM engine is again packaged xtrabackup that is Innobackupex, of course Innobackupex in the backup MyISAM engine will add a read-only lock.
Xtrabackup Open Source Tools official website: Https://www.percona.com/downloads/XtraBackup Find your suitable version, try to use the latest, of course, the official website also provides RPM package, However, to facilitate the download of the binary package for rapid deployment installation:
[Email protected] src]# wget https://www.percona.com/downloads/xtrabackup/percona-xtrabackup-2.4.5/> binary/ Tarball/percona-xtrabackup-2.4.5-linux-x86_64.tar.gz[[email protected] src]# TAR-ZXVF Percona-xtrabackup-2.4.5-linux-x86_64.tar.gz-c/usr/local/#配置说明手册及环境变量 [[email protected] src]# vim/etc/man.conf ... Slightly... Manpath/usr/local/percona-xtrabackup-2.4.5-linux-x86_64/man[[email protected] src]# vim/etc/profile.d/ Percona-xtrabackup.shexport path= $PATH:/usr/local/percona-xtrabackup-2.4.5-linux-x86_64/bin
The options parameters commonly used in Innobackupex are:
--host=name:mysql Host IP address--port=#:mysql port number--user=name:mysql user name--socket=name:mysql socket file path--databases= Name: Specify MySQL library--defaults-file: Specifies the file path to read the default MY.CNF, which is read/etc/my.cnf--incremental-basedir=name by default: Specify the directory name for a full backup--apply-log: Rollback INNODB transaction, a--redo-only for recovering data directly after data backup: Force backup log only redo, skip rollback, To do an incremental backup, you must use--copy-back: Restore the backup operation--include=name: Back up the included library table, for example:--include= "mysql.*" Back up all tables of the MySQL library--slave-info: Back up from the library, Plus the--slave-info backup directory will generate more than one Xtrabackup_slave_info file, which will save the main log file and the offset, the file content is similar to: "Change MASTER to Master_log_file=", Master_log_pos=0, used in the production of--safe-slave-backup from the library: and Slave-info, when initiating a backup, the slave will be paused to ensure that no temporary table opened when the backup Guaranteed consistency--no-lock: does not lock the table when backing up, if the MySQL session has "FLUSH TABLES with READ lock;" It's not locked.
Basically, these parameters are sufficient for the most common scenarios, of course, if there are other special scenarios where the parameter options can be viewed Innobackupex--help or man Innobackupex See more Of course there are other tools available in Percona-xtrabackup:
Xbcrypt: For encrypting or decrypting a database xbstream: Streaming backup support Xbcloud, xbcloud_osenv: Tools for uploading and downloading on the cloud
This article from "Technical essay" blog, declined reprint!
Brief Percona-xtrabackup Open Source Toolkit