1.Xtrabackup Tools Introduction:
Xtrabackup is a tool for data backup of InnoDB, which supports online hot backup (without affecting data reading and writing during backup), is a good substitute for the commercial Backup tool InnoDB Hotbackup.
Xtrabackup has two main tools: Xtrabackup and Innobackupex
Xtrabackup can only back up InnoDB and xtradb two types of datasheets, not backup MyISAM data tables
Innobackupex is a reference to InnoDB Hotbackup's innoback script modifications, Innobackupex is a Perl script encapsulation that encapsulates xtrabackup. The main purpose is to backup the InnoDB and MyISAM engine tables at the same time, but a read lock is required to handle the MyISAM. and added some options to use.
2.Xtrabackup Installation:
The simplest is the PRM package, which is installed using the binary package method below
1. Unpack the Package
[Root@nagios opt]# TAR-ZXVF xtrabackup-1.6.3.tar.gz
2. Move the unpacked package to the/usr/local/directory and rename it to Xtrabackup
[Root@nagios opt]# MV Xtrabackup-1.6.3/usr/local/xtrabackup
3. Modifying environment variables
[Root@nagios opt]# export path= $PATH:/usr/local/xtrabackup/bin
The following error occurred while backing up the database
[Root@nagios bin]# pwd
/usr/local/xtrabackup/bin
[Root@nagios bin]#/innobackupex-1.5.1--port=3306--tmpdir= '/tmp/mysql '--defaults-file= '/etc/my.cnf '--database= ' Firstdb '--user= ' root '--password= ' MySQL '/root/db_backups
innobackupex-1.5.1:: warning:ignored Unrecognized line 2 in options: ' xtrabackup:Error:Please set parameter ' DataDir '
Innobackupex-1.5.1:fatal error:no ' mysqld ' Group in MySQL options
Innobackupex-1.5.1:fatal error:or No ' datadir ' option in the group ' mysqld ' in MySQL options
Add or modify the database storage directory in the database configuration file:
[Root@nagios bin]# cat/etc/my.cnf |grep datadir
DataDir =/usr/local/mysql/data
3.Xtrabackup Full BACKUP Database
./innobackupex-1.5.1
Directory of--ibbackup= '/usr/local/xtrabackup/bin/xtrabackup ' */xtrabackup files
--port=3306 */mysql Database Port
--tmpdir= '/tmp/mysql ' */mysql database mysql.sock file storage directory
--defaults-file= '/etc/my.cnf ' */mysql database configuration file
--database= ' firstdb '/backup MySQL database, you can back up multiple databases, each database separated by a space, with double quotes
--user= ' root ' */mysql database username
password= ' mysql ' */mysql database password
/root/db_backups */mysql backup Data storage directory
Full Backup and Package
./innobackupex-1.5.1--port=3306--tmpdir= '/tmp/mysql '--defaults-file= '/etc/my.cnf '--database= ' the Firstdb '--user= ' Root '--password= ' mysql '--stream=tar/root/db_backups |gzip/root/db_backups/*.*.tar.gz