免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2981 | 回复: 0
打印 上一主题 下一主题

Mysql管理必备工具Maatkit详解之九(mk-parallel-dump) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-02-23 12:15 |只看该作者 |倒序浏览

Mysql管理必备工具Maatkit详解之九(mk-parallel-dump)
2009年07月16日 作者: 大头刚 
mk-parallel-dump - 顾名思义,并行mysqldump工具。安装方法可以参考
这里

mysqldump是单进程的,同时只能备份1个表。mk-parallel-dump它会同时并发4个mysqldump进程,同时备份4个表,默认是先备份大表,在备份小表。和mysqldump出来生成一个文件不同,它将每个表生成一个单独的文件。默认使用gzip对文件进行压缩。
使用mysqldump备份40G左右的数据,大概需要2小时。而使用mk-parallel-dump不到1小时能完成,效率能提高200%左右。
例如:
mk-parallel-dump -u  -p  -h  --basedir /u01/backup/bk_mysql
default: 1 tables, 1 chunks, 1 successes,  0 failures, 0.10 wall-clock time, 0.06 dump time
恢复的话,直接解压导入就可,和mysqldump的恢复一样。当然也可以用mk-parallel-restore进行恢复,这个工具将在
下一篇
进行介绍。
解释几个重要的参数文件。
–tab: 将数据备份成load data的形式,将生成一个load文本文件,一个建表sql文件。只能备份本地的MYSQL,不能远程。
–basedir: 备份到指定目录。
–[no]gzip:是否压缩,默认是压缩。
OK,还有其他的一些参数,可以看下帮助文件。
mk-parallel-dump --help
mk-parallel-dump dumps sets of MySQL tables simultaneously via mysqldump or
SELECT INTO OUTFILE.  For more details, please use the --help option, or try
'perldoc mk-parallel-dump' for complete documentation.

Usage: mk-parallel-dump options> [--] external args>

Options:
  --age               Dump only tables modified since this long ago, or not
                      dumped since this long ago.  Optional suffix s=seconds,
                      m=minutes, h=hours, d=days; if no suffix, s is used.
  --askpass           Prompt for password for connections
  --basedir           Base directory for creating files
  --[no]binlogpos -b  Dump the master/slave position (default)
  --charset       -A  Default character set
  --chunksize     -C  Number of rows or data size to dump per file
  --csv               Do --tab dump in CSV format (implies --tab)
  --databases     -d  Dump only this comma-separated list of databases
  --dbregex           Dump only databases whose names match this pattern
  --defaults-file -F  Only read mysql options from the given file
  --[no]defaultset    When --sets given, dump tables not in any set
  --[no]flushlock -k  Use FLUSH TABLES WITH READ LOCK (default)
  --[no]flushlog      Execute FLUSH LOGS when getting binlog positions
  --[no]gzip          Compress files with gzip (default 1)
  --help              Show this help message
  --host          -h  Connect to host
  --ignoredb      -g  Ignore this comma-separated list of databases
  --ignoreengine  -E  Dump no data for this comma-separated list of storage
                      engines (default FEDERATED,MRG_MyISAM)
  --ignoretbl     -n  Ignore this comma-separated list of tables
  --[no]locktables    Use LOCK TABLES (disables --flushlock)
  --losslessfp    -L  Convert double and float to decimal with extra precision
                      so the reinserted values will be equal to the original
                      values.  Requires --tab.
  --numthread     -m  Number of threads (default 4)
  --password      -p  Password to use when connecting
  --port          -P  Port number to use for connection
  --quiet         -q  Quiet output; disables --verbose
  --setperdb          Dump each database as a separate set
  --sets              Dump this comma-separated list of sets
  --settable          database.table where backup sets are stored
  --setvars           Set these MySQL variables (default wait_timeout=10000)
  --socket        -S  Socket file to use for connection
  --stopslave         Issue STOP SLAVE on server before dumping data
  --tab           -T  Dump tab-separated (sets --umask 0)
  --tables        -t  Dump only this comma-separated list of tables
  --tblregex          Dump only tables whose names match this pattern
  --test              Print commands instead of executing them
  --umask             Set umask to this value, in octal
  --user          -u  User for login if not current user
  --verbose       -v  Be verbose; can specify multiple times; default
  --version           Output version information and exit
  --wait          -w  Wait limit when server is down (default 5m).  Optional
                      suffix s=seconds, m=minutes, h=hours, d=days; if no
                      suffix, s is used.
  --locktables and --flushlock are mutually exclusive
  --sets and --setperdb are mutually exclusive
  --losslessfp requires --tab

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/111930/showart_2184923.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP