MySQLStudy -- MySQLinnodb engine backup tool XtraBackup (Install) _ MySQL

Source: Internet
Author: User
Tags percona percona server perl script
MySQLStudy-MySQLinnodb engine backup tool XtraBackup (Install) Xtrabackup is a tool for InnoDB data backup and supports online hot backup (data read/write is not affected during backup ), it is a good commercial backup tool InnoDBHotbackup for MySQL Study-one of MySQL innodb engine backup tools XtraBackup (Install)

Xtrabackup is a tool used to back up InnoDB data. it supports online hot backup (data read/write is not affected during backup) and is a good alternative to InnoDB Hotbackup.

Xtrabackup has two main tools: xtrabackup and innobackupex.

(1) xtrabackup can only back up InnoDB and XtraDB data tables, but cannot back up MyISAM data tables.

(2) innobackupex-1.5.1 encapsulates xtrabackup, which is a script encapsulation, so innodb and myisam can be backed up at the same time, but a read lock is needed when processing myisam

To install XtraBackup, first install MySQL

1. View MySQL version

[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,201 5, 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. install and configure

In the/etc/my. cnf file, configure the directory where the data is stored.

[Root @ rh64 XtraBackup] # cat/etc/my. cnf | grep datadir

Datadir =/var/lib/mysql

3. download and install

Installation:

[Root @ rh64 XtraBackup] # ls-l

Total 26808

-Rw-r ----- 1 mysql 5664452 Oct 27 percona-xtrabackup-2.3.2-1.el6.x86_64.rpm

-Rw-r ----- 1 mysql 20807976 Oct 27 percona-xtrabackup-debuginfo-2.3.2-1.el6.x86_64.rpm

-Rw-r ----- 1 mysql 971264 Oct 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

---- Installation error. the libev. so Library is required.

Download the libev installation package:

[Root @ rh64 libev-4.15] # tar zxvf libev-4.15.tar.gz

Install libev:

[Root @ fig 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 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 ...@

......

[Root @ rh64 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 :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. so.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.

Libtool: link: (cd ". libs" & rm-f "libev. la" & ln-s "../libev. la" "libev. la ")

Make [1]: Leaving directory '/home/mysql/libev-4.15'

[Root @ rh64 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.

Libtool: install: chmod 644/usr/local/lib/libev.

Libtool: install: ranlib/usr/local/lib/libev.

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 have 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 full 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

-Have your system administrator add LIBDIR to '/etc/ld. so. Conf'

See any operating system documentation about shared libraries

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'

View libev installation information:

[Root @ rh64 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

Configure the lib access environment:

[Root @ rh64 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

Re-install:

[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

--- Still failed !!! It may be that the libev version is incorrect. you should download libev (64)

Download libev (64) and install:

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

[Root @ rh64 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 ####################################### #### [100%]

[Root @ rh64 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

[Root @ rh64 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:

[Root @ rh64 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

[Root @ rh64 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 ################################### ####### [1, 67%]

3: percona-xtrabackup-debu ################################### ####### [1, 100%]

---- Installation successful !!!

[Root @ rh64 XtraBackup] # man innobackupex

INNOBACKUPEX (1) Percona XtraBackup INNOBACKUPEX (1)

NAME

Innobackupex-innobackupex Documentation

The innobackupex tool is a Perl script that acts as a wrapper for the xtrabackup C program. It

Is a patched version of the innobackup Perl script that Oracle distributes with the InnoDB Hot

Backup tool. It enables more functionality by integrating xtrabackup and other functions such

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 section explains how to use innobackupex in detail.

PREREQUISITES

Connection and Privileges Needed

Percona XtraBackup needs to be able to connect to the database server and perform operations on

The server and the datadir when creating a backup, when preparing in some scenarios and when

Restoring it. In order to do so, there are privileges and permission requirements on its execu-

Tion that must be fulfilled.

Privileges refers to the operations that a system user is permitted to do in the database

Server. They are set at the database server and only apply to users in the database server.

Permissions are 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 are set at

System level and only apply to system users.

Whether xtrabackup or innobackupex is used, there are two actors involved: the user invoking

Program-a system user-and the user discovery Ming action in the database server-a database

User. Note that these are different users in different places, even tough they may have the same

Username.

All the invocations of innobackupex and xtrabackup in this documentation assumes that the system

User has the appropriate permissions and you are providing the relevant options for connecting

The database server-besides the options for the action to be performed Med-and the database user

Has adequate privileges.

Connecting to the server

The database user used to connect to the server and its password are 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/

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.