下载XtraBackup:
# wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.6/binary/tarball/percona-xtrabackup-2.4.6-Linux-x86_64.tar.gz
解压软件:
# tar xvf percona-xtrabackup-2.4.6-Linux-x86_64.tar.gz -C /usr/local/
# cd /usr/local/
# mv percona-xtrabackup-2.4.6-Linux-x86_64/ xtrabackup
设置环境变量:
# echo "export PATH=/usr/local/xtrabackup/bin:\$PATH">>/etc/profile
# source /etc/profile
安装依赖包:
yum install -y perl-Digest-MD5
全备数据库:
[mysql@publicserver ~]$ innobackupex --defaults-file=/etc/my.cnf --user=root --password=centos --socket=/var/lib/mysql/mysql.sock /mysqlbk
增量备份数据库:
[mysql@publicserver ~]$ innobackupex --defaults-file=/etc/my.cnf --user=root --password=centos --socket=/var/lib/mysql/mysql.sock --incremental --incremental-basedir=/mysqlbk/2017-03-26_21-56-46 /mysqlbk_rec
全备恢复准备:
[mysql@publicserver ~]$ innobackupex --defautls-file=/mysqlbk/my.cnf --apply-log --redo-only /mysqlbk/2017-03-26_21-56-46
增量恢复准备:
[mysql@publicserver ~]$ innobackupex --defaults-fil=/mysqlbk/my.cnf --apply-log /mysqlbk/2017-03-26_21-56-46 --incremental-dir=/mysqlbk_rec/2017-03-26_21-57-11
执行 innobackupex --apply-log:
[mysql@publicserver ~]$ innobackupex --defautls-file=/mysqlbk/my.cnf --apply-log /mysqlbk/2017-03-26_21-56-46
执行恢复:
[mysql@publicserver ~]$ innobackupex --defaults-file=/mysqlbk/my.cnf --socket=/var/lib/mysql/mysql.sock --copy-back /mysqlbk/2017-03-26_21-56-46
压缩备份集:
[mysql@publicserver ~]$ innobackupex --defaults-file=/usr/local/mysql/my.cnf --user=root --password=centos --socket=/tmp/mysql.sock --stream=tar /tmp | gzip ->/mysqlbk/mysql_fullbackup.tar.gz
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。