1.安装XtraBackup
yum的安装方法:
自动
$ rpm -Uhv http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm |
然后会看到:
Retrieving http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpmPreparing... ########################################### [100%] 1:percona-release ########################################### [100%] |
手动
[percona]name = CentOS $releasever - Perconabaseurl=http://repo.percona.com/centos/$releasever/os/$basearch/enabled = 1gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-perconagpgcheck = 1 |
测试安装库
使用yum list | grep percona来确保安装
yum list | grep percona |
会出现以下信息:
percona-release.x86_64 0.0-1 installed...Percona-Server-client-51.x86_64 5.1.47-rel11.1.51.rhel5 perconaPercona-Server-devel-51.x86_64 5.1.47-rel11.1.51.rhel5 perconaPercona-Server-server-51.x86_64 5.1.47-rel11.1.51.rhel5 perconaPercona-Server-shared-51.x86_64 5.1.47-rel11.1.51.rhel5 perconaPercona-Server-test-51.x86_64 5.1.47-rel11.1.51.rhel5 percona...xtrabackup.x86_64 1.2-22.rhel5 percona |
2、进行完整备份
备份必须连接mysql,相关选项有
备份可以使用管理员帐号,也可开放一个权限最小的帐号
grant user 'bkpuser'@'localhost' identified by '123';grant reload,lock tables,replication client on *.* to 'bkpuser'@'localhost';flush privileges; |
进行一次完整备份,需要指定的相关选项有
–defaults-file=/usr/local/mysql/my.cnf 指定使用的配置文件指定备份所存放的目标目录,例如 /tmp
innobackupex --user=root --password=root --socket=/tmp/mysql.sock --defaults-file=/usr/local/mysql/my.cnf /tmp |
3、进行增量备份
进行第一次增量备份,需要在有一次完整备份的基础上进行
innobackupex --user=root --password=root --socket=/tmp/mysql.sock --defaults-file=/usr/local/mysql/my.cnf --incremental /root/one --incremental-basedir=/tmp |
进行第二次增量备份,需要指定上一次增量备份的目录
–incremental /root/two 指定这次增量备份目录 –incremental-basedir=/root/one 知道上次增量备份目录新闻热点
疑难解答