[root@mail mydumper-0.2.3]# yum install glib2-devel mysql-devel zlib-devel pcre-devel ncurses-devel cmake biso
[root@mail mydumper-0.2.3]# wget http://launchpad.net/mydumper/0.2/0.2.3/+download/mydumper-0.2.3.tar.gz
解压:
cmake .
make && make install
搞定


报错:

CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found.   Please set CMAKE_C_COMPILER to a valid compiler path or name.



解决方法:安装gcc和gcc-c++
yum install gcc
yum install gcc-c++


mydumper主要参数

–host, -h 连接的mysql服务器

–user, -u 用户备份的连接用户

–password, -p

–port, -P  连接端口

–socket, -S  连接socket文件

–database, -B 需要备份的数据库

–table-list, -T 需要备份的表,用,分隔

–outputdir, -o  输出的目录

–build-empty-files ,-e   如果表数据是空,还是产生一个空文件,默认无数据则只有表结构文件

–regex, -x  支持正则表达式,如mydumper –regex ’^(?!(mysql|test))’

–ignore-engines, -i 忽略的存储引擎

–no-schemas, -m  不导出表结构

–long-query-guard  长查询,默认60s,超过则通过mydumper

–kill-long-queries, -k 可以设置kill长查询

–verbose, -v 0 = silent, 1 = errors, 2 = warnings, 3 = info,默认是2

–binlogs, -b  导出binlog

–daemon, -D  启用守护进程模式

–snapshot-interval, -I  dump快照间隔时间,默认60s

–logfile, -L  mysqldumper日志输出,一般在Daemon模式下使用

myloader 大多参数和mydumper一样

–directory, -d  要还原的数据目录

–overwrite-tables, -o Drop any existing tables when restoring schemas






备份到指定目录:

#time mydumper  -u root -p '***' -B xxx -v 2 -c -t 6 -o /data/mydumper/renrendai/  


恢复:

# myloader -u root -p 123456  -P 3307 -d /backup/database/export-20111119/ –overwrite-tables