Xtrabackup has two main tools: Xtrabackup, Innobackupex
(1) Xtrabackup can only back up InnoDB and xtradb two types of data tables, not backup MyISAM datasheet
(2) innobackupex-1.5.1 encapsulates the Xtrabackup, is a script encapsulation, so it can back up the processing InnoDB and MyISAM at the same time, but need to add a read lock when processing MyISAM
(3) Use Help: Http://www.percona.com/docs/wiki/percona-xtrabackup:start
Environment: CentOS 5.4,xtrabackup-1.6.tar.gz
1, first download from the http://www.percona.com/
wget http://www.percona.com/downloads/XtraBackup/XtraBackup-1.6/Linux/binary/i686/xtrabackup-1.6.tar.gz
2, check whether the server installed MySQL version, if not to install a good MySQL
There must be datadir=/var/lib/mysql in the my.cnf.
Description
--DATABASE=ZZTX A separate backup of the ZZTX database, if you do not add this parameter then that is to do a full library backup
2>/data/back_data/zztx.log output information to the log
1>/DATA/BACK_DATA/ZZTX.TAR.GZ package compression is stored in the file
Here you can write a script to do the backup (backup.sh)
#!/bin/sh
echo "Start Backup ..." ' Date '
Log=zztx01_ ' Date +%y%m%d%h%m '. Log
Str=zztx01_ ' Date +%y%m%d%h%m '. tar.gz
Innobackupex--user=root--password=123456--defaults-file=/etc/my.cnf--database=zztx--stream=tar/data/back_data/ 2>/data/back_data/$log | Gzip 1>/data/back_data/$str
echo "Backup completed ..." ' Date '
5. Recover Data
1 Stop the Database first: service mysqld stop
2 decompression TAR-IZXVF zztx.tar.gz-c/data/back_data/db/(no db, need mkdir/data/back_data/db/)
3) Restoration of Innobackupex--user=root--password--defaults-file=/etc/my.cnf--apply-log/data/back_data/db/(- The command for the Apply-log option is to start the MySQL service on a backup.
Innobackupex--user=root--password--defaults-file=/etc/my.cnf--copy-back/data/back_data/db/(--copy-back The option commands copy data from the backup directory, index, log to the initial location specified in the My.cnf file. )
4) Weighting Chown-r mysql.mysql/var/lib/mysql/*
5 Restart database service mysqld restart
6) Delete garbage cd/var/lib/mysql/&& rm xtrabackup*
Go to Database view, everything ok~
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.