首頁 資料庫 mysql教程 MySQL Study之--MySQL innodb引擎备份工具XtraBackup之一(Install)_MySQL

MySQL Study之--MySQL innodb引擎备份工具XtraBackup之一(Install)_MySQL

May 30, 2016 pm 05:10 PM
引擎

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

 

3、下载安装

MySQL Study之--MySQL innodb引擎备份工具XtraBackup之一(Install)_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 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 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.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.a

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.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 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 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'

 

查看libev安装信息:

[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

 

配置lib访问环境:

[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

 

再次安装:

[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的版本不对,应该下载libev(64)

 

 

下载libev(64)并安装:

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

 

安装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########################################### [ 67%]

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

 

  ----安装成功!!!

   

[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 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 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 a

       system level and only apply to system users.

       Whether xtrabackup or innobackupex is used, there are two 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 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 - 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/

 

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

熱門話題

Java教學
1663
14
CakePHP 教程
1420
52
Laravel 教程
1313
25
PHP教程
1266
29
C# 教程
1239
24
Redmi G Pro 2024 3 月 4 日見,冰封散熱 狂暴引擎 PC 版加持 Redmi G Pro 2024 3 月 4 日見,冰封散熱 狂暴引擎 PC 版加持 Mar 02, 2024 pm 12:19 PM

Redmi官方今日宣布,全新RedmiGPro2024將於3月4日正式發表。也就是說,下週我們將迎來這款令人期待的新品發表會。 RedmiGPro2024以電競旗艦身份全面登場,將手機產業能力深度融入筆電業務,呈現210W超強性能釋放,Redmi性能再創新高。搭載i9-14900HX處理器與RTX4060顯示卡,將電競與創作完美結合,實現雙重進化。就此來看,這款新品的性能表現將會再次提升,實際效果如何令人期待。官方預熱中提到,全新RedmiGPro2024帶來了狂暴引擎PC版。手機技術賦能,三大子引

實測英偉達AI遊戲引擎:與NPC即時聊天,中文流暢爆了 實測英偉達AI遊戲引擎:與NPC即時聊天,中文流暢爆了 Mar 04, 2024 am 09:40 AM

黃院士在《Cyber​​punk2077》裡搞的智能NPC,已經飆起中文了?量子位的一手體驗,親眼見證了NPC們流利地用中英雙語對話,表情動作自然,口型也能對上……如果不是眼前就有一塊屏幕,真的會有種身臨其境之感。今年的CES展上,英偉達用智慧引擎AvatarCloudEngine(ACE),讓遊戲NPC「活」了起來,引起了不小的震撼。 △CES上展示的智慧NPC使用ACE,遊戲中的角色可以與玩家進行逼真的語音對話,同時展現出生動的表情和肢體動作,而無需事先準備劇本。亮相當時,就有育碧、騰訊、網易、米哈遊等國

超逼真渲染!虛幻引擎技術大牛解讀全局光照系統Lumen 超逼真渲染!虛幻引擎技術大牛解讀全局光照系統Lumen Apr 08, 2023 pm 10:21 PM

即時全域光照(Real-time GI)一直是電腦圖形學的聖杯。多年來,業界也提出多種方法來解決這個問題。常用的方法包透過利用某些假設來約束問題域,例如靜態幾何,粗糙的場景表示或追蹤粗糙探針,以及在兩者之間插值照明。在虛幻引擎中,全局光照和反射系統Lumen這項技術便是由Krzysztof Narkowicz和Daniel Wright一起創立的。目標是建造一個與前人不同的方案,能夠實現統一照明,以及類似烘烤一樣的照明品質。近期,在SIGGRAPH 2022上,Krzysztof Narko

引擎格局變革:三缸引擎挑戰六缸和八缸統治地位 引擎格局變革:三缸引擎挑戰六缸和八缸統治地位 Oct 08, 2023 pm 10:57 PM

10月8日消息,美國汽車市場正在經歷一場引擎蓋下的變革,以前備受喜愛的六缸和八缸動力發動機正逐漸失去統治地位,而三缸發動機則嶄露頭角。 10月8日的消息顯示,美國汽車市場正在經歷引擎蓋下的變化。過去備受喜愛的六缸和八缸動力引擎正在逐漸失去統治地位,而三缸引擎則開始嶄露頭角在大多數人的印像中,美國人鍾情於大排量車型,而"美式大V8"一直是美國車的代名詞。然而,根據外媒近期公佈的數據,美國汽車市場的格局正在發生巨大變化,引擎蓋下的戰鬥正愈演愈烈。據了解,在2019年之前,美

PHP網頁模板引擎使用方法及常見問題解答 PHP網頁模板引擎使用方法及常見問題解答 Jun 08, 2023 pm 12:23 PM

隨著網路技術的不斷發展,網頁模板引擎成為了網站開發中不可或缺的一部分。 PHP網頁模板引擎是其中一種常用的網頁模板引擎。本文將介紹PHP網頁範本引擎的使用方法及常見問題。一、什麼是PHP網頁模板引擎? PHP網頁範本引擎是一種將網頁設計與業務邏輯分開的技術。採用模板引擎的方式可以將網頁的顯示與邏輯處理分開,使得程式碼整潔清晰,易於維護。 PHP網頁模板引擎與原

解決SAS連線Oracle資料庫時出現引擎問題 解決SAS連線Oracle資料庫時出現引擎問題 Mar 08, 2024 am 10:12 AM

解決SAS連接Oracle資料庫時出現引擎問題,需要具體程式碼範例在使用SAS軟體進行資料分析時,經常需要連接資料庫來取得資料進行分析處理。而其中連接Oracle資料庫是比較常見的操作。然而,有時候在連接Oracle資料庫時會出現引擎問題,導致連線失敗或無法正常操作。本文將介紹如何解決在SAS軟體中連接Oracle資料庫時出現引擎問題的情況,並提供具體的程式碼

解決SAS無法找到Oracle引擎的問題 解決SAS無法找到Oracle引擎的問題 Mar 08, 2024 pm 12:21 PM

解決SAS無法找到Oracle引擎的問題,需要具體程式碼範例在使用SAS軟體進行資料處理和分析時,我們經常會遇到需要連接到外部資料庫的情況,其中Oracle資料庫是一個常見的選擇。然而,有時候當我們嘗試連接Oracle資料庫時,SAS卻提示找不到Oracle引擎的問題,這給我們的工作帶來了困擾。本文將介紹如何解決SAS無法找到Oracle引擎的問題,並提供具體

SAS無法辨識Oracle引擎的解決方法 SAS無法辨識Oracle引擎的解決方法 Mar 08, 2024 pm 12:42 PM

SAS無法辨識Oracle引擎的問題是在使用SAS連接Oracle資料庫時常見的挑戰。這個問題可能是由於SAS沒有正確配置或識別Oracle引擎所導致的。在解決這個問題之前,我們首先需要先明確了解SAS和Oracle之間的連接方式以及一些常見的錯誤原因。接下來我將介紹一些解決這個問題的具體方法,並提供一些程式碼範例供參考。確認Oracle引擎對SAS的支

See all articles