码迷,mamicode.com
首页 > 数据库 > 详细

mysql之 percona-xtrabackup 2.4.7安装(热备工具)

时间:2017-07-24 21:27:02      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:sync   apply   命令   目录   sed   man   copy   ack   error   

1.安装依赖包
 
#yum -y install perl perl-devel libaio libaio-devel perl-Time-HiRes perl-DBD-MySQL
2. 安装percona-xtrabackup工具
 
# rpm -ivh percona-xtrabackup-24-2.4.7-1.el5.x86_64.rpm
提示缺少依赖:
 
warning: percona-xtrabackup-24-2.4.7-2.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
error: Failed dependencies:
    libev.so.4()(64bit) is needed by percona-xtrabackup-24-2.4.7-2.el6.x86_64
    libnuma.so.1()(64bit) is needed by percona-xtrabackup-24-2.4.7-2.el6.x86_64
    rsync is needed by percona-xtrabackup-24-2.4.7-2.el6.x86_64
安装libnuma依赖包命令:
 
#yum -y install numactl
3.查看安装目录
 
# rpm -ql percona-xtrabackup-24
/usr/bin/innobackupex
/usr/bin/xbcloud
/usr/bin/xbcloud_osenv
/usr/bin/xbcrypt
/usr/bin/xbstream
/usr/bin/xtrabackup
/usr/share/doc/percona-xtrabackup-24-2.4.7
/usr/share/doc/percona-xtrabackup-24-2.4.7/COPYING
/usr/share/man/man1/innobackupex.1.gz
/usr/share/man/man1/xbcrypt.1.gz
/usr/share/man/man1/xbstream.1.gz
/usr/share/man/man1/xtrabackup.1.gz
4.创建专用备份账户
 
mysql> create user backup@‘localhost‘ identified by ‘123456‘;
mysql> grant reload,PROCESS,lock tables,Replication client,super on *.* to backup@‘localhost‘;
5.全备、增备及恢复
 
全备:
#innobackupex --defaults-file=/etc/my.cnf  --user=root --password=123456 /home/backup/full
 
全备恢复:
innobackupex --apply-log /home/backup/full/2017-06-14_21-26-56
 
innobackupex --copy-back /home/backup/full/2017-06-14_21-26-56
 
增备:
#innobackupex --defaults-file=/etc/my.cnf --user=root --password=123456 --incremental-basedir=/home/backup/full/2017-06-14_21-26-56 --incremental /home/backup/incremental
 
增备恢复:
第一步是在所有备份目录下重做已提交的日志:
innobackupex --apply-log --redo-only /home/backup/full/2017-06-14_21-26-56
innobackupex --apply-log --redo-only /home/backup/full/2017-06-14_21-26-56 --incremental-dir=/home/backup/incremental/2017-06-14_21-35-43
第二步回滚未完成的日志:
innobackupex --apply-log /home/backup/full/2017-06-14_21-26-56
第三步拷贝:
service mysql stop
执行copy-back之前需要清空mysql的data目录
innobackupex --copy-back /home/backup/full/2017-06-14_21-26-56
启动之前注意data目录的权限问题
service mysql start

mysql之 percona-xtrabackup 2.4.7安装(热备工具)

标签:sync   apply   命令   目录   sed   man   copy   ack   error   

原文地址:http://www.cnblogs.com/qingchen-24K/p/7230806.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!