zoukankan      html  css  js  c++  java
  • percona-xtrabackup系列一:简单使用

    1:什么是percona-xtrabackup

    Percona XtraBackup is an open-source hot backup utility for MySQL -based servers that doesn’t lock your database during the backup.

    It can back up data from InnoDB, XtraDB,and MyISAM tableson MySQL 5.1 [1], 5.5 and5.6 servers, as well as Percona Server with XtraDB.For a high-level overview of many of its advanced features, including a featurecomparison, please see AboutPercona Xtrabackup.

    Whether it is a 24x7 highly loaded server or alow-transaction-volume environment, Percona XtraBackup isdesigned to make backups a seamless procedure without disrupting theperformance of the server in a production environment.Commercial support contracts areavailable.

    Percona XtraBackup is a combination of the xtrabackup C program,and the innobackupex Perl script. The xtrabackupprogramcopies and manipulates InnoDB and XtraDB datafiles, and the Perl script enables enhanced functionality,such as interacting with a running MySQL server and backing up MyISAM tables.


    2:软件及文档获取
    软件下载:https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.2.10/binary/debian/squeeze/x86_64/Percona-XtraBackup-2.2.10-re623acb-squeeze-x86_64-bundle.tar


    3:软件使用讲解

    a.备份数据
    #innobackupex --user=root --password=123456 /databackup/

    b.做统一检查
    #innobackupex --apply-log /databackup/2014-09-10_11-49-44/


    c.模拟数据丢失
    #rm -rf /usr/local/mysql/data/*
    #ll /usr/local/mysql/data/


    d.恢复数据
    #innobackupex --copy-back /databackup/2014-09-10_11-49-44/

    e.重启mysql服务,发现报错,pkill掉,然后启动一切正常
    #/etc/init.d/mysqld restart
    ERROR! MySQL server PID file could not be found!
    Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/data/serv01.host.com.pid).

    #查看恢复的数据目录,拥有者和所属组不是mysql用户,我们更改拥有者和所属组
    #ll /usr/local/mysql/data/
    total 18468
    drwxr-xr-x. 2 root root 4096 Sep 10 22:02 game
    drwxr-xr-x. 2 root root 4096 Sep 10 22:02 hello
    -rw-r-----. 1 root root 18874368 Sep 10 21:51 ibdata1
    drwxr-xr-x. 2 root root 4096 Sep 10 22:02 larrydb
    drwxr-xr-x. 2 root root 4096 Sep 10 22:02 mnt
    drwxr-xr-x. 2 root root 4096 Sep 10 22:02 mysql
    -rw-rw----. 1 mysql mysql 0 Sep 10 22:02 mysql-bin.index
    drwxr-xr-x. 2 root root 4096 Sep 10 22:02 performance_schema
    drwxr-xr-x. 2 root root 4096 Sep 10 22:02 test
    -rw-r--r--. 1 root root 24 Sep 10 22:02 xtrabackup_binlog_pos_innodb

    #chown mysql.mysql /usr/local/mysql/data/ -R
    再次启动即可
    #ps -ef | grep mysql


    4:参考资料
    #http://www.percona.com/doc/percona-xtrabackup/2.1/

  • 相关阅读:
    [转]只有tcp6没有tcp问题
    Makefile 中:= ?= += =的区别
    【转】docker images 介绍
    [转]我眼中的 Docker(二)Image
    【转】一个简单的Dockerfile实例
    【转】Prometheus 介绍
    [转]MySQL索引类型按存储类型和逻辑区分
    【转】mysql索引类型
    用Unity制作游戏,你需要深入了解一下IL2CPP
    c++中CreateEvent函数
  • 原文地址:https://www.cnblogs.com/xiaoit/p/4512708.html
Copyright © 2011-2022 走看看