mysql备份还原-centos6.5下安装xtrabackup2.2.3(二进制,源码包,rpm包安装方式汇总)

1 简介
    Xtrabackup是一个对InnoDB做数据备份的工具,支持在线热备份(备份时不影响数据读写),是商业备份工具MySQL Enterprise Backup(meb)的一个很好的替代品。
    xtrabackup有两个主要的工具:innobackupex和xtrabackup,xtrabackup只能备份InnoDB和XtraDB数据表,innobackupex封装了xtrabackup,可以备份MyISAM数据表。
2 测试环境
    操作系统:CentOS release 6.5 (Final)
    linux内核:2.6.32-431.el6.x86_64
    数据库版本:5.6.21-enterprise-commercial
    xtrabackup版本:2.2.3
    innobackupex版本:1.5.1
    CPU:Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz 4核
    硬盘:512GB
    内存:2GB
    安装依赖:

[root@localhost ~]# yum install perl-DBD-MySQL.x86_64
[root@localhost ~]# yum install perl-Time-HiRes.x86_64     

3 rpm包安装及配置

    下载rpm安装包:
[root@localhost ~]# wget http://www.percona.com/downloads/XtraBackup/XtraBackup-2.2.3/binary/redhat/6/x86_64/percona-xtrabackup-2.2.3-4982.el6.x86_64.rpm
    安装rpm包:
[root@localhost ~]# rpm -ivh percona-xtrabackup-2.2.3-4982.el6.x86_64.rpm 
    查看版本号:
[root@localhost ~]# xtrabackup --version
xtrabackup version 2.2.3 based on MySQL server 5.6.17 Linux (x86_64) (revision id: )
    简单测试:
[root@localhost ~]# innobackupex --user=root --defaults-file=/etc/my.cnf --database=test /tmp
    安装成功!
    卸载rpm包:
[root@localhost ~]# rpm -qa | grep xtrabackup
percona-xtrabackup-2.2.3-4982.el6.x86_64
[root@localhost ~]# rpm -e percona-xtrabackup-2.2.3-4982.el6.x86_64
4 二进制执行文件安装及配置
    下载二进制安装文件:
[root@localhost ~]# wget http://www.percona.com/downloads/XtraBackup/XtraBackup-2.2.3/binary/tarball/percona-xtrabackup-2.2.3-4982-Linux-x86_64.tar.gz
    解压安装包:
[root@localhost ~]# tar xzvf percona-xtrabackup-2.2.3-4982-Linux-x86_64.tar.gz 
    查看版本号:
[root@localhost ~]# /root/percona-xtrabackup-2.2.3-Linux-x86_64/bin/innobackupex --version
InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013.  All Rights Reserved.
    简单备份测试:
[root@localhost ~]# /root/percona-xtrabackup-2.2.3-Linux-x86_64/bin/innobackupex --user=root --defaults-file=/etc/my.cnf --database=test /tmp
    安装成功!
5 源码包安装及配置
    5.1 方法1:

    直接下载指定源码包
[root@localhost ~]# wget http://www.percona.com/downloads/XtraBackup/LATEST/source/tarball/percona-xtrabackup-2.2.6.tar.gz
[root@localhost ~]# tar xzvf percona-xtrabackup-2.2.6.tar.gz
[root@localhost ~]# cd percona-xtrabackup-2.2.6
    5.2 通过bzr下载
[root@localhost ~]# yum install bzr
[root@localhost ~]bzr branch lp:percona-xtrabackup/2.2
    5.3 编译安装
    安装依赖
[root@localhost ~]# yum install cmake libaio-devel  ncurses-devel bzip2-devel libxml2-devel libgcrypt-devel
   开始编译
[root@localhost ~]# cmake -DBUILD_CONFIG=xtrabackup_release && make -j4
    默认安装
[root@localhost ~]# make install
    注:默认安装在/usr/local/xtrabackup/目录下
    简单备份测试:
[root@localhost bin]# /usr/local/xtrabackup/bin/innobackupex --defaults-file=/etc/my.cnf --host=127.0.0.1 --port=3306 --user=root --password=****** --database=test  /tmp
    指定目录安装:
[root@localhost ~]# make DESTDIR=/tmp/ install
    会安装在/tmp/usr/local/xtrabackup/目录下
****************************************************************************************
    原文地址: http://blog.csdn.net/jesseyoung/article/details/41577461
    博客主页: http://blog.csdn.net/jesseyoung
****************************************************************************************

你可能感兴趣的:(mysql,备份,安装,xtrabackup)