zoukankan      html  css  js  c++  java
  • 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/data
    service 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
  • 相关阅读:
    《算法竞赛进阶指南》0x42树状数组 楼兰图腾
    《算法竞赛进阶指南》0x41并查集 奇偶游戏
    .NET技术-常规操作
    TFS-在windows上配置自动化部署
    * 常用软件下载
    Docker 修改网桥网段
    Docker
    Docker
    NETCORE
    .NET框架
  • 原文地址:https://www.cnblogs.com/JiangLe/p/5847081.html
Copyright © 2011-2022 走看看