xtrabackup备份与恢复过程

一般需要安装这二个依懒

yum install numactl perl-Digest-MD5 -y

远程备份到所要恢复的服务器上,执行以下命令

nohup innobackupex –stream=xbstream –databases=”sfa mysql performance_schema” /tmp | ssh 192.168.3.100 “xbstream -x -C /data/backup”&

执行以上命令,要保持,两边服务器,都己经安装了xtrabackup

下载地址:wget https://downloads.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-2.4.23/binary/tarball/percona-xtrabackup-2.4.23-Linux-x86_64.glibc2.12.tar.gz

恢复的时候,用以下的命令,在你备份的目录执行一下,先停掉MYSQL的服务器

/etc/init.d/mysqld stop

innobackupex –apply-log –redo-only backup/

等提示完成了, 并OK了,就可以执行下面的

mv /data/backup/mysql/ /data/mysql/data/

mv /data/backup/yayaw/ /data/mysql/data/

mv /data/backup/ibdata1 /data/mysql/ibdata/

mv /data/backup/performance_schema/ /data/mysql/data/

chown -R mysql.root /data/mysql/

启动MYSQL

/etc/init.d/mysqld start

不留备份哈,复制要很长时间