percona-xtrabackup 备份工具是很好用的备份工具(centos环境)
1,安装
1.1 安装依赖程序:
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, 备份恢复数据库实例
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 恢复
复制apply-for后的备份文件到数据目录下
启动mysql服务