MySQL Study之--MySQL innodb引擎备份工具XtraBackup之一(Install)
Xtrabackup是一个对InnoDB做数据备份的工具,支持在线热备份(备份时不影响数据读写),是商业备份工具InnoDB Hotbackup的一个很好的替代品。
?
Xtrabackup有两个主要的工具:xtrabackup、innobackupex
?
(1)xtrabackup只能备份InnoDB和XtraDB两种数据表,而不能备份MyISAM数据表
?
(2)innobackupex-1.5.1则封装了xtrabackup,是一个脚本封装,所以能同时备份处理innodb和myisam,但在处理myisam时需要加一个读锁
?
安装XtraBackup,首先要安装MySQL
?
1、查看MySQL版本
[root@rh64 ~]# service mysql start
Starting MySQL (Percona Server)...[ ?OK ?]
[root@rh64 ~]# mysql -u root -p
Enter password:?
Welcome to the MySQL monitor. ?Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.25-73.1 Percona Server (GPL), Release 73.1, Revision 07b797f
Copyright (c) 2009-2015 Percona LLC and/or its affiliates
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>?
?
2、安装配置
?
在/etc/my.cnf文件要配置数据所存储的目录
[root@rh64 XtraBackup]# cat /etc/my.cnf |grep datadir
datadir=/var/lib/mysql
?
安装:
[root@rh64 XtraBackup]# ls -l
total 26808
-rw-r----- 1 mysql mysql ?5664452 Oct 27 10:27 percona-xtrabackup-2.3.2-1.el6.x86_64.rpm
-rw-r----- 1 mysql mysql 20807976 Oct 27 10:27 percona-xtrabackup-debuginfo-2.3.2-1.el6.x86_64.rpm
-rw-r----- 1 mysql mysql ? 971264 Oct 27 10:27 percona-xtrabackup-test-2.3.2-1.el6.x86_64.rpm
?
[root@rh64 XtraBackup]# rpm -ivh percona-xtrabackup-2.3.2-1.el6.x86_64.rpm
warning: percona-xtrabackup-2.3.2-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
error: Failed dependencies:
? ? ? ? libev.so.4()(64bit) is needed by percona-xtrabackup-2.3.2-1.el6.x86_64
?
----安装出错,要求需有libev.so库支持
?
下载libev安装包:
[root@rh64 libev-4.15]# tar zxvf libev-4.15.tar.gz?
?
安装libev:
[root@rh64 libev-4.15]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...?
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking