myloader原理介绍

myloader恢复主要流程
 
1、首先由myloader主线程完成建库建表,依次将备份目录下建库和建表文件执行应用到目标数据库实例中;
 
2、接着myloader主线程会生成多个工作线程,由这些工作线程将所有database.table.*.sql文件中的记录导入到对应表中,这个阶段是并行的,并行粒度为文件,工作线程完成所有database.table.*.sql 文件数据导入后销毁;
 
3、最后主线程将创建函数、存储进程、事件,以及创建表视图、触发器的文件执行导入对应数据库和表中。
 
myloader参数详解
 
myloader --help
Usage:
  myloader [OPTION...] multi-threaded MySQL loader
 
Help Options:
  -?, --help                        Show help options
 
Application Options:
  -d, --directory                   Directory of the dump to import之前备份好的现在需要导入的文件夹
  -q, --queries-per-transaction     Number of queries per transaction, default 1000每次事物执行的查询数量,默认是1000
  -o, --overwrite-tables            Drop tables if they already exist如果要恢复的表存在,则先drop掉该表,使用该参数,需要备份时候要备份表结构
  -B, --database                    An alternative database to restore into还原到指定的数据库
  -s, --source-db                   Database to restore选择被还原的数据库,将这个数据库数据还原到--database指定的数据库里
  -e, --enable-binlog               Enable binary logging of the restore data启用还原数据的二进制日志
  -h, --host                        连接的主机名
  -u, --user                        用来备份的用户名
  -p, --password                    用户密码
  -P, --port                        连接端口
  -S, --socket                      使用socket通信时的socket文件
  -t, --threads                     开启的备份线程数,默认是4
  -C, --compress-protocol           压缩与mysql通信的数据
  -V, --version                     显示版本号
  -v, --verbose                     输出信息模式, 0 = silent, 1 = errors, 2 = warnings, 3 = info, 默认为2
 
myloader恢复流程图
 

 

 
 

 

 
 

posted on 2017-06-15 15:08  lzfj  阅读(2478)  评论(0编辑  收藏  举报

导航