首页 > 代码库 > innobackupex 使用说明
innobackupex 使用说明
1、创建备份相关用户
create user ‘backuper‘@‘127.0.0.1‘ identified by ‘123456‘;grant reload,lock tables,replication client,process,super on *.* to ‘backuper‘@‘127.0.0.1‘;grant create,insert,select on percona_schema.xtrabackup_history to ‘backuper‘@‘127.0.0.1‘;create user ‘backuper‘@‘localhost‘ identified by ‘123456‘;grant reload,lock tables,replication client,process,super on *.* to ‘backuper‘@‘localhost‘;grant create,insert,select on percona_schema.xtrabackup_history to ‘backuper‘@‘localhost‘;
2、创建全备
innobackupex --user=backuper --password=123456 --host=127.0.0.1 --port=3306 /tmp/backup/
3、创建增备
innobackupex --user=backuper --password=123456 --host=127.0.0.1 --port=3306 --incremental --incremental-basedir=/tmp/backup/2016-09-07_04-14-17 /tmp/backup_incremental
4、在全备上前滚日志
innobackupex --apply-log --redo-only /tmp/backup/2016-09-07_04-14-17
5、在增备上前滚&回滚日志
innobackupex --apply-log --incremental-dir=/tmp/backup_incremental/2016-09-07_04-22-36 /tmp/backup/2016-09-07_04-14-17
6、把处于一致的备份复制到datadir目录下
innobackupex --defaults-file=/etc/my.cnf --copy-back /tmp/backup/2016-09-07_04-14-17
7、调整数据的属主,属组 & 启动mysql服务
chown -R mysql:mysql /usr/local/mysql/dataservice mysqld start
8、以single-file的方式来备份数据库
innobackupex --user=backuper --password=123456 --host=127.0.0.1 --port=3306 --stream=xbstream /tmp >/tmp/backup/mysql_3306_full.xbstream
9、把单文件解包成文件夹
xbstream -x < /tmp/backup/mysql_3306_full.xbstream -C /tmp/datadir
10、前滚&回滚日志
innobackupex --apply-log --use-memory=2G /tmp/datadir
11、把处于一致的备份复制到datadir目录下
innobackupex --defaults-file=/etc/my.cnf --copy-back /tmp/datadir
innobackupex 使用说明
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。