增量备份:
xtrabackup –backup –target-dir=/data/backup/base –datadir=/var/lib/mysql
xtrabackup –backup –target-dir=/data/backup/inc –incremental-basedir=/data/backup/base/ –datadir=/var/lib/mysql
xtrabackup –backup –target-dir=/data/backup/inc2 –incremental-basedir=/data/backup/inc –datadir=/var/lib/mysql
增量恢复:
xtrabackup –prepare –apply-log-only –target-dir=/data/backup/base
xtrabackup –prepare –apply-log-only –target-dir=/data/backup/base/ –incremental-dir=/data/backup/inc
xtrabackup –prepare –target-dir=/data/backup/base/ –incremental-dir=/data/backup/inc2
注意:–apply-log-only 应该用于合并除了最后一次之外的所有增量备份。
还原:关闭mysql,直接copy,然后修改权限再启动
局部备份:
To back up only tables in the test database,you can use the following command:
xtrabackup –backup –datadir=/var/lib/mysql –target-dir=/data/backups –tables=”^test[.].*”
xtrabackup –backup –datadir=/var/lib/mysql –target-dir=/data/backups –tables=”^test[.]t1″