MySQL备份恢复工具安装

一、mydumper安装

​ 下载链接:https://github.com/maxbube/mydumper

​ 1、安装依赖包

yum install -y glib2-devel mysql-devel zlib-devel pcre-devel openssl-devel

​ 2、解压

tar -zxvf mydumper-0.9.5.tar.gz

​ 3、安装

cd mydumper-0.9.5
cmake .
make
二、xtrabackup 二进制安装

​ 下载链接:https://www.percona.com/downloads/Percona-XtraBackup-2.4/LATEST/

​ 或:https://github.com/percona/percona-xtrabackup/tree/2.4

​ 解压即可用

tar -zxvf percona-xtrabackup-2.4.18-Linux-x86_64.libgcrypt153.tar.gz
三、xtrabackup 源码安装

​ 下载链接:https://www.percona.com/downloads/Percona-XtraBackup-2.4/LATEST/

​ 或:https://github.com/percona/percona-xtrabackup/tree/2.4

​ 1、安装依赖包

yum install cmake gcc gcc-c++ libaio libaio-devel automake autoconf bzr bison libtool ncurses5-devel libgcrypt-devel libcurl-devel vim-common python-sphinx -y

​ 2、编译

unzip percona-xtrabackup-release-2.4.16.zip
mv percona-xtrabackup-release-2.4.16 xtrabackup-2.4.16
cd xtrabackup-2.4.16

cmake -DBUILD_CONFIG=xtrabackup_release -DWITH_BOOST=/usr/local/boost_1_59_0 && make -j4

​ 编译成功

[ 96%] Building CXX object sql/CMakeFiles/sql.dir/srv_session_info_service.cc.o
[ 96%] Building CXX object sql/CMakeFiles/sql.dir/srv_session_service.cc.o
[ 96%] Building CXX object sql/CMakeFiles/sql.dir/auth/sha2_password_common.cc.o
[ 96%] Building CXX object sql/CMakeFiles/sql.dir/mysqld_daemon.cc.o
Linking CXX static library ../archive_output_directory/libsql.a
[100%] Built target sql

​ 3、安装

make DESTDIR=/home/mysql/tools install

​ 安装成功

-- Up-to-date: /home/mysql/tools/usr/local/xtrabackup/xtrabackup-test/mysql-test-run
-- Installing: /home/mysql/tools/usr/local/xtrabackup/xtrabackup-test/lib/My/SafeProcess/my_safe_process
-- Up-to-date: /home/mysql/tools/usr/local/xtrabackup/xtrabackup-test/lib/My/SafeProcess/my_safe_process
-- Installing: /home/mysql/tools/usr/local/xtrabackup/xtrabackup-test/lib/My/SafeProcess/Base.pm
[mysql@localhost xtrabackup-2.4.16]$

​ 4、常见报错

#报错 1
CMake Error at cmake/libev.cmake:23 (MESSAGE):
  Could not find libev on your system
Call Stack (most recent call first):
  storage/innobase/xtrabackup/src/xbcloud/CMakeLists.txt:31 (FIND_EV)

#解决方法
#下载 libev 库
https://fossies.org/linux/misc/libev-4.31.tar.gz/
tar -zxvf libev-4.31.tar.gz  
./configure  
make && make install
#报错 2
Linking C static library libarchive.a
[ 23%] Built target archive_static
make: *** [all] Error 2

#解决方法
yum -y install python-sphinx
#报错 3
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make[2]: *** [libmysqld/CMakeFiles/sql_embedded.dir/__/sql/item_geofunc_relchecks_bgwrap.cc.o] Error 4
[ 74%] Building CXX object sql/CMakeFiles/sql.dir/item_geofunc_internal.cc.o
make[1]: *** [libmysqld/CMakeFiles/sql_embedded.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 74%] Building CXX object sql/CMakeFiles/sql.dir/item_geofunc_relchecks.cc.o
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make[2]: *** [sql/CMakeFiles/sql.dir/item_geofunc_buffer.cc.o] Error 4
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2
make: *** [all] Error 2


Linking CXX static library ../archive_output_directory/libsql.a
[ 82%] Built target sql
make: *** [all] Error 2

#原因内存不够,建议内存调到 5G 以上
Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐