MySQL study--mysql InnoDB Engine Backup tool One of the Xtrabackup (Install)

Source: Internet
Author: User
Tags mysql version sha1 wrapper percona percona server perl script

MySQL study--mysql InnoDB Engine Backup tool One of the Xtrabackup (Install)

Xtrabackup is a innodb to do data backup tools, Support Online hot backup (backup without affecting the data read and write), is a commercial backup tool InnoDB hotbackup a good alternative.
Xtrabackup has two main tools: Xtrabackup, Innobackupex
(1) Xtrabackup can only back up InnoDB and xtradb two data tables, but not myisam data tables
(2) The innobackupex-1.5.1 encapsulates the Xtrabackup, which is a script wrapper, so the InnoDB and MyISAM can be backed up at the same time, but a read lock is required to process the MyISAM

to install xtrabackup, first install MySQL


1. View MySQL version
[[Email protected] ~]# service MySQL start
starting MySQL (Percona Server) ... [OK]
[email protected] ~]# 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), Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
affiliates. Other names trademarks of their respective
owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
mysql>

2. Installation Configuration


In the/etc/my.cnf file to configure the directory where the data is stored
[Email protected] xtrabackup]# cat/etc/my.cnf |grep datadir
Datadir=/var/lib/mysql

3. Download and install

650) this.width=650; "Src=" http://img.blog.csdn.net/20151027145816348?watermark/2/text/ Ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/center "Style=" Border:none; "/>

Installation:
[Email protected] xtrabackup]# ls-l
Total 26808
-rw-r-----1 mysql mysql 5664452 Oct 10:27 percona-xtrabackup-2.3.2-1.el6.x86_64.rpm
-rw-r-----1 mysql mysql 20807976 Oct 10:27 percona-xtrabackup-debuginfo-2.3.2-1.el6.x86_64.rpm
-rw-r-----1 mysql mysql 971264 Oct 10:27 percona-xtrabackup-test-2.3.2-1.el6.x86_64.rpm

[email protected] 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

----Installation error, libev.so Library support is required

To download the Libev installation package:
[Email protected] libev-4.15]# tar zxvf libev-4.15.tar.gz

Install Libev:
[Email protected] 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 is 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's 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 this 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 for bsd-or ms-compatible name Lister (nm) .../usr/bin/nm-b
Checking the name Lister (/usr/bin/nm-b) interface ... BSD NM
Checking whether Ln-s works ... yes
Checking the maximum length of command line arguments ... 1966080
Checking whether the shell understands some XSI constructs ... yes
Checking whether the shell understands "+ =" ... yes
Checking how to convert X86_64-unknown-linux-gnu file names to X86_64-UNKNOWN-LINUX-GNU format ... func_convert_file_noop
Checking how to convert X86_64-unknown-linux-gnu file names to toolchain format ... func_convert_file_noop
Checking for/usr/bin/ld option to reload object files ...-r
Checking for objdump ... objdump
Checking how to recognize dependent libraries ... Pass_all
Checking for dlltool ... no
Checking how to associate Runtime and link libraries ... printf%s\n
Checking for ar ... Ar
Checking for archiver @FILE support ... @
......

[[email protected] libev-4.15]# make
Make All-am
MAKE[1]: Entering directory '/home/mysql/libev-4.15 '
/bin/sh./libtool--tag=cc--mode=compile gcc-dhave_config_h-i. -G-O3-MT EV.LO-MD-MP-MF. Deps/ev. Tpo-c-O Ev.lo ev.c
Libtool:compile:gcc-dhave_config_h-i.-G-O3-MT ev.lo-md-mp-mf. Deps/ev. Tpo-c Ev.c-fpic-dpic-o. libs/ev.o
Ev.c:1531:warning: ' ev_default_loop_ptr ' initialized and declared ' extern '
Libtool:compile:gcc-dhave_config_h-i.-G-O3-MT ev.lo-md-mp-mf. Deps/ev. Tpo-c ev.c-o ev.o >/dev/null 2>&1
Mv-f. Deps/ev. Tpo. Deps/ev. Plo
/bin/sh./libtool--tag=cc--mode=compile gcc-dhave_config_h-i. -G-O3-MT EVENT.LO-MD-MP-MF. Deps/event. Tpo-c-O Event.lo event.c
Libtool:compile:gcc-dhave_config_h-i.-G-O3-MT event.lo-md-mp-mf. Deps/event. Tpo-c Event.c-fpic-dpic-o. LIBS/EVENT.O
Libtool:compile:gcc-dhave_config_h-i.-G-O3-MT event.lo-md-mp-mf. Deps/event. Tpo-c event.c-o EVENT.O >/dev/null 2>&1
Mv-f. Deps/event. Tpo. Deps/event. Plo
/bin/sh./libtool--tag=cc--mode=link gcc-g-o3-version-info 4:0:0-o libev.la-rpath/usr/local/lib ev.lo Event.lo -lm
Libtool:link:gcc-shared-fpic-dpic. libs/ev.o. Libs/event.o-lm-o3-wl,-soname-wl,libev.so.4-o. Libs/libev.s o.4.0.0
Libtool:link: (CD ". Libs" && rm-f "libev.so.4" && ln-s "libev.so.4.0.0" "libev.so.4")
Libtool:link: (CD ". Libs" && rm-f "libev.so" && ln-s "libev.so.4.0.0" "libev.so")
Libtool:link:ar cru. LIBS/LIBEV.A ev.o EVENT.O
Libtool:link:ranlib. libs/libev.a
Libtool:link: (CD ". Libs" && rm-f "libev.la" && ln-s ". /libev.la "" libev.la ")
MAKE[1]: Leaving directory '/home/mysql/libev-4.15 '


[[email protected] libev-4.15]# make install
MAKE[1]: Entering directory '/home/mysql/libev-4.15 '
/bin/mkdir-p '/usr/local/lib '
/bin/sh./libtool--mode=install/usr/bin/install-c libev.la '/usr/local/lib '
Libtool:install:/usr/bin/install-c. libs/libev.so.4.0.0/usr/local/lib/libev.so.4.0.0
Libtool:install: (cd/usr/local/lib && {ln-s-f libev.so.4.0.0 libev.so.4 | | {rm-f libev.so.4 && ln-s libev.so.4.0.0 libev.so.4;}; })
Libtool:install: (cd/usr/local/lib && {ln-s-f libev.so.4.0.0 libev.so | | {rm-f libev.so && ln-s libev.so.4.0.0 libev.so;}; })
Libtool:install:/usr/bin/install-c. libs/libev.lai/usr/local/lib/libev.la
Libtool:install:/usr/bin/install-c. libs/libev.a/usr/local/lib/libev.a
Libtool:install:chmod 644/USR/LOCAL/LIB/LIBEV.A
Libtool:install:ranlib/usr/local/lib/libev.a
Libtool:finish:path= "/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/ Bin:/sbin "Ldconfig-n/usr/local/lib
----------------------------------------------------------------------
Libraries has been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
In a given directory, Libdir, you must either use Libtool, and
Specify the pathname of the library, or use the '-llibdir '
Flag during linking and do at least one of the following:
-Add Libdir to the ' Ld_library_path ' environment variable
During execution
-Add Libdir to the ' Ld_run_path ' environment variable
During linking
-Use the '-WL,-RPATH-WL,LIBDIR ' linker flag
-Your system administrator add Libdir to '/etc/ld.so.conf '
See all operating system documentation about GKFX libraries for
More information, such as the LD (1) and ld.so (8) manual pages.
----------------------------------------------------------------------
/bin/mkdir-p '/usr/local/include '
/usr/bin/install-c-M 644 ev.h ev++.h event.h '/usr/local/include '
/bin/mkdir-p '/usr/local/share/man/man3 '
/usr/bin/install-c-M 644 Ev.3 '/usr/local/share/man/man3 '
MAKE[1]: Leaving directory '/home/mysql/libev-4.15 '

To view Libev installation information:
[[email protected] libev-4.15]# Find/-name ' libev.so* '
/home/mysql/libev-4.15/.libs/libev.so.4.0.0
/home/mysql/libev-4.15/.libs/libev.so
/home/mysql/libev-4.15/.libs/libev.so.4
/usr/local/lib/libev.so.4.0.0
/usr/local/lib/libev.so.4
/usr/local/lib/libev.so

To Configure the Lib Access environment:
[Email protected] xtrabackup]# Cat/etc/profile
Export Libdir=/usr/local/lib
Export Ld_library_path=/usr/local/lib
Export Ld_run_path=/usr/local/lib
"/etc/profile" 82L, 1898C written

Install again:

[Email protected] 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


---still FAIL!!! Maybe the Libev version is wrong, you should download Libev (64)


Download Libev (64) and install:

Http://rpmfind.net/linux/rpm2html/search.php?query=libev.so.4 () (64bit)


[[Email  protected] mysql]# rpm-ivh libev-4.04-2.el6.x86_64.rpm 
warning:libev-4.04-2.el6.x86_64. Rpm:header V4 dsa/sha1 Signature, key ID 66534c2b:nokey
Preparing ...                ########################################### [100%]
   1:libev           & nbsp      ########################################### [100%]


[Email protected] mysql]# Rpm-qa |grep Libev
Libevent-1.4.13-4.el6.x86_64
libevent-1.4.13-4.el6.i686
Libev-4.04-2.el6.x86_64
[Email protected] mysql]# RPM-QL Libev
/usr/lib64/libev.so.4
/usr/lib64/libev.so.4.0.0
/usr/share/doc/libev-4.04
/usr/share/doc/libev-4.04/changes
/usr/share/doc/libev-4.04/license
/usr/share/doc/libev-4.04/readme

Install Xtrabackup:


[[email protected] xtrabackup]# ls
percona-xtrabackup-2.3.2-1.el6.x86_64.rpm percona-xtrabackup-test-2.3.2-1.el6.x86_64.rpm
percona-xtrabackup-debuginfo-2.3.2-1.el6.x86_64.rpm


[Email protected] xtrabackup]# RPM-IVH *
Warning:percona-xtrabackup-2.3.2-1.el6.x86_64.rpm:header V4 dsa/sha1 Signature, key ID Cd2efd2a:nokey
Preparing ... ########################################### [100%]
1:percona-xtrabackup ########################################### [33%]
2:percona-xtrabackup-test########################################### [67%]
3:percona-xtrabackup-debu########################################### [100%]


----Installation success!!!

[email protected] xtrabackup]# man Innobackupex

Innobackupex (1) Percona xtrabackup Innobackupex (1)
NAME
Innobackupex-innobackupex Documentation

The Innobackupex tool is a Perl script, acts as a wrapper for the Xtrabackup C program. It
is a patched version of the Innobackup Perl script, Oracle distributes with the InnoDB hot
Backup tool. It enables more functionality by integrating xtrabackup and other functions such as
File copying and streaming, and adds some convenience. It lets you perform point-in-time backups
of innodb/xtradb tables together with the schema definitions, MyISAM tables, and other por-
tions of the server.
This manual sections explains how to use the Innobackupex in detail.
Prerequisites
Connection and Privileges Needed
Percona Xtrabackup needs to is able to connect to the database server and perform operations on
The server and the DataDir when creating a backup while preparing in some scenarios and when
Restoring it. In order to does so, there is privileges and permission requirements on its execu-
tion that must is fulfilled.
Privileges refers to the operations, a system user is permitted to does in the database
Server. They is set at the database server and only apply to users in the database server.
Permissions is those which permits a user to perform operations on the system, like reading,
Writing or executing on a certain directory or start/stop a system service. They is set at a
System level and only apply to system users.
Whether xtrabackup or Innobackupex is used, there is, actors involved:the user invoking the
Program-a system User-and The user performing action in the database server-a database
User. Note that these is different users in different places, even tough they could have the same
Username.
All the invocations of Innobackupex and xtrabackup in this documentation assumes the system
User has the appropriate permissions and is providing the relevant options for connecting
The database Server-besides the options for the action Performed-and the database user
has adequate privileges.
Connecting to the server
The database user used to connect to the server and its password is specified by the--user and
--password option,
$ Innobackupex--user=dbuser--password=secret/path/to/backup/dir/
$ Innobackupex--user=luke--password=us3th3f0rc3--stream=tar./| BZIP2-
$ xtrabackup--user=dvader--password=14my0urf4th3r--backup--target-dir=/data/bkps/


----Here, xtrabackup installation is complete!!!


This article is from the "Tianya blog," Please make sure to keep this source http://tiany.blog.51cto.com/513694/1706794

MySQL study--mysql InnoDB Engine Backup tool One of the Xtrabackup (Install)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.