percona-xtrabackup 備份工具是很好用的備份工具(centos環(huán)境)
1,安裝
1.1 安裝依賴(lài)程序:
yum install cmake gcc gcc-c++ libaiolibaio-devel automake autoconf bzr bison libtool ncurses-devel libgcrypt-devellibcurl-devel libev-devel python-sphinx perl-Digest-MD5 perl-DBD-MySQL -y
1.2 下載并安裝xtrabackup工具:
wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.7/binary/redhat/6/x86_64/percona-xtrabackup-24-2.4.7-1.el6.x86_64.rpm
rpm -ivh percona-xtrabackup-24-2.4.7-1.el6.x86_64.rpm
2, 備份恢復(fù)數(shù)據(jù)庫(kù)實(shí)例
2.1 備份
innobackupex --defaults-file=/etc/mysql/my.cnf? ? ? ? ? ? --user=xxx --password='xxx'? /tmp/backup
2.2 apply-for
innobackupex --defaults-file=/etc/mysql/my.cnf --apply-log --user=xxx --password='xxx'? /tmp/backup/xxxx-xx-xx_xx-xx-xx
2.3 恢復(fù)
復(fù)制apply-for后的備份文件到數(shù)據(jù)目錄下
啟動(dòng)mysql服務(wù)