mydumper安装及安装故障汇总

?

mydumper是针对mysql数据库备份的一个轻量级第三方的开源工具,备份方式术语逻辑备份。它支持多线程。备份速度远高于原生态的mysqldump以及众多优异特性。

因此该工具是DBA们的不二选择。

本文主要描写叙述该工具的安装及其出现异常的解决方法。

1、mydumper特性(直接參考readme)
  * Parallelism (hence, speed) and performance (avoids expensive character set conversion routines, efficient code overall)
  * Easier to manage output (separate files for tables, dump metadata, etc, easy to view/parse data)
  * Consistency - maintains snapshot across all threads, provides accurate master and slave log positions, etc
  * Manageability - supports PCRE for specifying database and tables inclusions and exclusions
  It does not support schema dumping and leaves that to ‘mysqldump --no-data‘

2、获取mydumper及安装方法
下载地址:https://launchpad.net/mydumper
== How to build it? ==
Run:
 cmake .
 make

One needs to install development versions of required libaries (MySQL, GLib, ZLib, PCRE):
NOTE: you must use the correspondent mysql devel package.

* Ubuntu or Debian: apt-get install libglib2.0-dev libmysqlclient15-dev zlib1g-dev libpcre3-dev libssl-dev
* Fedora, RedHat and CentOS: yum install glib2-devel mysql-devel zlib-devel pcre-devel openssl-devel
* openSUSE: zypper install glib2-devel libmysqlclient-devel pcre-devel zlib-devel
* MacOSX: port install glib2 mysql5 pcre pkgconfig cmake
 (You may want to run ‘port select mysql mysql5‘ afterwards)

One has to make sure, that pkg-config, mysql_config, pcre-config are all in $PATH

Binlog dump is disabled by default to compile with it you need to add -DWITH_BINLOG=ON to cmake options
###假设要使用binlog dump在编译的时候须要使用-DWITH_BINLOG=ON

3、快照工作原理
== How does consistent snapshot work? ==

This is all done following best MySQL practices and traditions:

* As a precaution, slow running queries on the server either abort the dump, or get killed
* Global write lock is acquired ("FLUSH TABLES WITH READ LOCK")
* Various metadata is read ("SHOW SLAVE STATUS","SHOW MASTER STATUS")
* Other threads connect and establish snapshots ("START TRANSACTION WITH CONSISTENT SNAPSHOT")
** On pre-4.1.8 it creates dummy InnoDB table, and reads from it.
* Once all worker threads announce the snapshot establishment, master executes "UNLOCK TABLES" and starts queueing jobs.

This for now does not provide consistent snapshots for non-transactional engines - support for that is expected in 0.2 :)

4、怎样过滤数据库
== How to exclude (or include) databases? ==

Once can use --regex functionality, for example not to dump mysql and test databases:

mydumper --regex ‘^(?!(mysql|test))‘

Of course, regex functionality can be used to describe pretty much any list of tables.

== How to exclude MERGE or Federated tables ==

Use same --regex exclusion syntax. Again, engine-specific behaviors are targetted for 0.2

5、实际安装过程
# ls mydump*
mydumper-0.6.2.tar.gz
# tar -xvf mydumper-0.6.2.tar.gz
# cd mydumper-0.6.2
[[email protected] mydumper-0.6.2]# cmake .
[[email protected] mydumper-0.6.2]# make && make install

6、安装过程中的异常
错误1:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
PCRE_INCLUDE_DIR (ADVANCED)
   used as include directory in directory /root/mydumper-0.6.2
PCRE_PCRE_LIBRARY (ADVANCED)
    linked by target "mydumper" in directory /root/mydumper-0.6.2
    linked by target "myloader" in directory /root/mydumper-0.6.2
###须要安装pcre-devel包。yum install pcre-devel

错误2:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
MYSQL_INCLUDE_DIR (ADVANCED)
   used as include directory in directory /home/robin/mydumper-0.6.2
   used as include directory in directory /home/robin/mydumper-0.6.2
   used as include directory in directory /home/robin/mydumper-0.6.2
###出现上述错误,是因为没有配置MYSQL_INCLUDE_DIR文件夹。
###假设是编译安装到非缺省路径,能够将mysql安装路径加入到/etc/profile或者家文件夹~/.bash_profile后source生效

错误3:
[[email protected] ~]# mydumper --help|more
mydumper: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
[[email protected] ~]# mydumper
mydumper: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
###出现上述错误。应考虑建立软链
# which libmysqlclient.so.18
/app/soft/mysql/lib/libmysqlclient.so.18
# ln -s  /app/soft/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18

错误4:
# mydumper -uusr1 -ppwd -B blos -o /tmp/bak
option parsing failed: Error parsing option -r, try --help
###參数和字符串不能连着写,笔者刚開始是也是丈二和尚摸不着头脑。

# mydumper --version
mydumper 0.6.2, built against MySQL 5.6.22

7、获取帮助
# mydumper --help|more
Usage:
  mydumper [OPTION...] multi-threaded MySQL dumping

Help Options:
  -?, --help                  Show help options

Application Options:
  -B, --database              Database to dump
  -T, --tables-list           Comma delimited table list to dump (does not exclude regex option)
  -o, --outputdir             Directory to output files to
  -s, --statement-size        Attempted size of INSERT statement in bytes, default 1000000
  -r, --rows                  Try to split tables into chunks of this many rows. This option turns off --chunk-filesize
  -F, --chunk-filesize        Split tables into chunks of this output file size. This value is in MB
  -c, --compress              Compress output files
  -e, --build-empty-files     Build dump files even if no data available from table
  -x, --regex                 Regular expression for ‘db.table‘ matching
  -i, --ignore-engines        Comma delimited list of storage engines to ignore
  -m, --no-schemas            Do not dump table schemas with the data
  -k, --no-locks              Do not execute the temporary shared read lock.  WARNING: This will cause inconsistent backups
  --less-locking              Minimize locking time on InnoDB tables.
  -l, --long-query-guard      Set long query timer in seconds, default 60
  -K, --kill-long-queries     Kill long running queries (instead of aborting)
  -D, --daemon                Enable daemon mode
  -I, --snapshot-interval     Interval between each dump snapshot (in minutes), requires --daemon, default 60
  -L, --logfile               Log file name to use, by default stdout is used
  --tz-utc                    SET TIME_ZONE=‘+00:00‘ at top of dump to allow dumping of TIMESTAMP data when a server has
                              data in different time zones or data is being moved between servers with different time zones,
                              defaults to on use --skip-tz-utc to disable.
  --skip-tz-utc              
  --use-savepoints            Use savepoints to reduce metadata locking issues, needs SUPER privilege
  --success-on-1146           Not increment error count and Warning instead of Critical in case of table doesn‘t exist
  --lock-all-tables           Use LOCK TABLE for all, instead of FTWRL
  -h, --host                  The host to connect to
  -u, --user                  Username with privileges to run the dump
  -p, --password              User password
  -P, --port                  TCP/IP port to connect to
  -S, --socket                UNIX domain socket file to use for connection
  -t, --threads               Number of threads to use, default 4
  -C, --compress-protocol     Use compression on the MySQL connection
  -V, --version               Show the program version and exit
  -v, --verbose               Verbosity of output, 0 = silent, 1 = errors, 2 = warnings, 3 = info, default 2

时间: 2024-07-28 17:05:16

mydumper安装及安装故障汇总的相关文章

NTVS Node.js Tools for Visual Studio 安装各种奇葩问题汇总。

首先是正确的安装方式.以vs 2012为例子,操作系统windows server 2012 R2,建议用虚拟机搞起. 1.安装vs 2012 2.升级2012 到 update 4 注意:一定要升级,不然安装1.0 Alpha后,在创建项目的时候会提示“未将对象引用到实例”.安装1.0 Beta后F5无法debug调试.总之升级就是了不要废话. 3.安装node.msi 也就是node windows 安装包 http://nodejs.org/download/ 选择对应的操作系统下载,安装

win7+cuda+anaconda python+tensorflow-gpu+keras安装成功版本匹配汇总

win7+cuda+anaconda python+tensorflow-gpu+keras安装成功版本匹配汇总 2019-09-20 15:06:03 wyx100 阅读数 38更多 分类专栏: ML,开发环境配置 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/wyx100/article/details/101061064 大家在安装配置过程中遇到了很多坑,其中大部分和软件之间的版本

CentOS 6.5 安装YouCompleteMe 报错汇总

支持折腾!!! 编译安装clang 3.6.0   编译器版本低 ====-----编译安装clang 3.6.0   编译器版本低---------------============== [[email protected] llvm-3.6.0]$ tar xf cfe-3.6.0.src.tar.xz  [[email protected] llvm-3.6.0]$ tar xf clang-tools-extra-3.6.0.src.tar.xz  [[email protected]

Linux-Centos6.5-Oracle数据库安装-DNS安装

Oracle数据库可以说是现在全球最好用,最安全的数据库,就是价格贵了点,一般都是大型企业,银行,债券,政府部门.但是随着经济增长,普通企业用Oracle数据库也逐渐增加,在运维方面可能都会有提到会Oracle的优先,今天先搭建Oracle环境,他需要很多变量,需要自行手动输入. 第一步首先装一台全新的6.5linux系统centos red都可以装上桌面组件,还有开发组件,还有默认的java组件给虚拟机配置IP,关闭防火墙,关闭二级防火墙,配置一些环境,把本地yum配置好.给虚拟机设置永久主机

Mac安装composer安装Yii2项目

[注释:]本人原创,如需转载请注明来源链接! 通过安装Composer方式安装Yii 如果还没有安装 Composer,你可以按 getcomposer.org 中的方法安装. 在 Linux 和 Mac OS X 中,你可以运行如下命令: curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer 步骤: 一.打开终端 二.安装composer: 1.终端输入:curl -s

[操作系统][Ubuntu 14.04] 安装Flash 安装QQ2013

[操作系统][Ubuntu 14.04] 安装Flash 安装QQ2013_郑少群个人网 一.安装Flash 打开Firefox浏览器弹出的Flash安装提醒早都烦死了,那么Ubuntu14.04怎么安装Flash呢? 1.32位系统命令行安装: 第一步 更新库: ? sudo apt-get update ? ? 第二步 安装Flash用下面的代码: sudo apt-get install flashplugin-installer ? 这样就将Flash和依赖装好了. 2.32位系统可视化

Centos7最小化安装下安装,编译lamp环境

centos7默认的php是5.5,mysql已经变为mariadb,如果想要自定义的配置,需要自己手动来编译配置.以下步骤在公司服务器上已经正常操作过. 1.安装centos7选择基本安装,配置完网络后首先要先关闭firewall: 停止firewall # systemctl stop firewalld.service 禁止firewall开机启动 # systemctl disable firewalld.service 2.安装iptables防火墙 yum方式安装iptables #

蓝的成长记——追逐DBA(2):安装!安装!久违的记忆,引起我对DBA的重新认知

蓝的成长记--追逐DBA(2):安装!安装!久违的记忆,引起我对DBA的重新认知 ***************************************声明*************************************** 个人在oracle路上的成长记录,其中以蓝自喻,分享成长中的情感.眼界与技术的变化与成长.敏感信息均以英文形式代替,不会泄露任何企业机密,纯为技术分享. 创作灵感源于对自己的自省和记录.若能对刚刚起步的库友起到些许的帮助或共鸣,欣慰不已. 欢迎拍砖,如有关

centos 安装 网络安装使用本地镜像文件安装

有时很无奈,无磁盘,U盘就只有4G而一个centos的盘是4.16G,如何将它装好网络安装,对不起,请你要使用20M以上的带宽,且注意使用网络启动方法 没有条件,创造条件也要上: 网络安装方式,需要下载其镜像,其镜像下载路径为:http://mirrors.163.com/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-netinstall.iso 使用iso工具做一下centos的安装u盘, 具体方法,http://jingyan.baidu.com/arti

kali 安装步骤 安装失败 kali install fail 已解决

kali 安装步骤 安装失败原因 fail install (原创  请注明出处) Kali Linux 前身是 BackTrack ,是一个基于 Debian 的 Linux 发行版,包含很多安全和取证方面的相关工具.支持 ARM架构. 从CDlinux跳到bt5 r3, 又从bt5 r3跳到kali 终于用到了一款强大的系统. 其支持的arm架构 armel还未使用,现使用x86结构现尝尝鲜.  后面决定把自己的pcduino或树莓派搞成这个系统. 但是kali安装过程中遇到了些头痛事,总结