今天使用mydumper命令从AWS上的RDS集群MYSQL数据库导出数据,发现Tidb官方提供的工具不太适合,所以就自己编译了一个来尝试一下,居然成功了。
首先我的系统是Centos7,并且已经安装过gcc等编译器。
1、需要安装依赖包:yum install -y glib2-devel* mysql-devel* zlib-devel* pcre-devel* openssl-devel*
2、下载安装包:wget https://launchpadlibrarian.net/185032423/mydumper-0.6.2.tar.gz
其他版本的安装包也可以去官网下载:只是我这里使用0.6版本编译成功了。官网连接:https://launchpad.net/mydumper
点击这一块找到0.6版本:
3、开始cmake编译
[root@test mydumper-0.6.2]# ls binlog.c cmake common.h docs g_unix_signal.h mydumper.h myloader.h server_detect.c binlog.h CMakeLists.txt config.h.in g_unix_signal.c mydumper.c myloader.c README server_detect.h [root@test mydumper-0.6.2]# cmake . -- The C compiler identification is GNU 4.4.7 -- The CXX compiler identification is GNU 4.4.7 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Using mysql-config: /usr/bin/mysql_config
-- ------------------------------------------------
-- MYSQL_CONFIG = /usr/bin/mysql_config
-- CMAKE_INSTALL_PREFIX = /usr/local
-- BUILD_DOCS = ON
-- WITH_BINLOG = OFF
-- RUN_CPPCHECK = OFF
-- Change a values with: cmake -D<Variable>=<Value>
-- ------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mysql/mydumper-0.6.2
4、cmake编译成功后才能继续make编译
[root@test mydumper-0.6.2]# make Scanning dependencies of target mydumper [ 25%] Building C object CMakeFiles/mydumper.dir/mydumper.c.o [ 50%] Building C object CMakeFiles/mydumper.dir/server_detect.c.o [ 75%] Building C object CMakeFiles/mydumper.dir/g_unix_signal.c.o Linking C executable mydumper [ 75%] Built target mydumper Scanning dependencies of target myloader [100%] Building C object CMakeFiles/myloader.dir/myloader.c.o Linking C executable myloader [100%] Built target myloader [root@test mydumper-0.6.2]# make install [ 75%] Built target mydumper [100%] Built target myloader Install the project... -- Install configuration: "" -- Installing: /usr/local/bin/mydumper -- Removed runtime path from "/usr/local/bin/mydumper" -- Installing: /usr/local/bin/myloader -- Removed runtime path from "/usr/local/bin/myloader"
5、这样子就成功了。
接下来就开始进行mydumper导出数据了,虽然依旧出现错误,但是会成功。
但是你会发现是有数据出现的,到导出的目录下你会发现sql文件。
如果使用中出现一些其他问题,可以参考这个博主的文章:https://yq.aliyun.com/sqlarticle/67079