Mydumper是一个针对MySQL和Drizzle的高性能多线程备份和恢复工具。开发人员主要来自 MySQL,Facebook,SkySQL公司。目前已经在一些线上使用了Mydumper。
yum -y install glib2-devel mysql-devel zlib-devel pcre-devel
tar xvf mydumper-0.5.1.tar.gz
cd mydumper-0.5.1/
cmake .
make
make install
metadata:元数据 记录备份开始和结束时间,以及binlog日志文件位置。
table data:每个表一个文件
table schemas:表结构文件
binary logs: 启用–binlogs选项后,二进制文件存放在binlog_snapshot目录下
daemon mode:在这个模式下,有五个目录0,1,binlogs,binlog_snapshot,last_dump。备份目录是0和1,间隔备份,如果mydumper因某种原因失败而仍然有一个好的快照,当快照完成后,last_dump指向该备份。
[root@localhost ~] mydumper -h localhost -u root -p 888 -t 6 -S /tmp/mysql.sock -B school -o /mysqlbackup/
[root@tianyun ~] ls /mysqlbackup/
binlog_snapshot
school.student1.sql
school.student4- schema.sql
school.t2_old-schema.sql ...
[root@localhost ~] cat /mysqlbackup/metadata
Started dump at: 2015-09-15 10:12:54 SHOW MASTER STATUS: Log: tianyun-bin.000003 Pos: 2089998 Finished dump at: 2015-09-15 10:12:54 Mydumper恢复示例
[root@localhost ~] myloader -h localhost -u root -p 888 -S /tmp/mysql.sock -d /mysqlbackup/ -o -B school