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/

  • 相关阅读:
    LeeCode-Spiral Matrix II
    HDU1281(二分图最大匹配,棋盘建图,找关键点)
    HDU1083(二分图最大匹配vector实现)
    HDU2444(判断是否为二分图,求最大匹配)
    HDU1166(线段树单点更新区间查询)
    HDU1045(二分图经典建模)
    POJ1220(大数进制转换)
    POJ3466(01背包变形)
    POJ3180(有向图强连通分量结点数>=2的个数)
    POJ1236 (强连通分量缩点求入度为0和出度为0的分量个数)
  • 原文地址:https://www.cnblogs.com/xiaoit/p/4512708.html
Copyright © 2011-2022 走看看