資料庫 & ERP

(Form Internet)xtrabackup-1.0 on CentOS 5

http://www.percona.com/docs/wiki/percona-xtrabackup:xtrabackup_manual
http://www.187299.com/archives/1436

install xtrabackup-1.0
wget http://www.percona.com/mysql/xtrabackup/1.0/source/xtrabackup-1.0-56.rhel5.src.rpm
rpm -i xtrabackup-1.0-56.rhel5.src.rpm
cd /usr/src/redhat/SOURCES/
tar -zxvf xtrabackup-1.0.tar.gz
cd xtrabackup-1.0
./configure
make
cd innobase/xtrabackup/
make
make install
innobackupex-1.5.1 --version

backup database(datadir=/var/lib/mysql)
mkdir /backup/
innobackupex-1.5.1 /backup/ --stream=tar --defaults-file=/etc/my.cnf > /backup/mysqldb_back.tar

restore database(datadir=/var/lib/mysql)
/etc/init.d/mysqld stop
rm -rf /var/lib/mysql
mkdir /var/lib/mysql
tar -ixvf /backup/mysqldb_back.tar -C /var/lib/mysql
innobackupex-1.5.1 --apply-log /var/lib/mysql --defaults-file=/etc/my.cnf
chown -R mysql:mysql /var/lib/mysql
/etc/init.d/mysqld start