pkman110 发表于 2010-02-23 12:47

Mysql管理必备工具Maatkit详解之十(mk-parallel-restore)


Mysql管理必备工具Maatkit详解之十(mk-parallel-restore)
2009年07月27日 作者: 大头刚 
mk-parallel-restore - Load files into MySQL in parallel. 安装方法可以参考
这里


上一篇
介绍了mk-parallel-dump并行备份,会把mysql的按照database模式,每个表都生成一个单独的备份文件,并统一在你指定的目录。
mk-parallel-restore其实就是mk-parallel-dump的反向操作,也会同时启用4个mysql进程去进行恢复,默认优先恢复大表。
使用起来很简单。例如:
mk-parallel-restore -u -p -h /u01/backup/bk_mysql_20090724
如果dump的时候指定了–tab,这里也加上–tab参数
mk-parallel-restore -u -p -h –tab /u01/backup/bk_mysql_20090724
这里需要注意一下,恢复的时候,如果恢复库没有备份库的database需要提前手工创建,mk-parallel-restore不会自动创建。否则会报错
gzip: stdout: Broken pipe
Issuing rollback() for database handle being DESTROY’d without explicit disconnect().
DBD::mysql::db do failed: Unknown database ‘xxxxxx’ at /usr/bin/mk-parallel-restore line 1778.
ok,在看下其他的参数。
mk-parallel-restore --help
mk-parallel-restore loads files into MySQL in parallel.For more details,
please use the --help option, or try 'perldoc mk-parallel-restore' for complete
documentation.

Usage: mk-parallel-restore options> PATH

Options:
--askpass             Prompt for a password when connecting to MySQL
--atomicresume    Treat chunks as atomic when resuming restore (default
                        yes)
--basedir             Directory where FIFO files will be created
--biggestfirst    Restore the biggest tables first for highest concurrency
                        (default yes)
--binlog            Set SQL_LOG_BIN to 1 or 0 to enable or disable binary
                        logging (default 1)
--bulkinsbufsize      Set bulk_insert_buffer_size before each LOAD DATA INFILE
--charset         -ASets the connection, database, and LOAD DATA INFILE
                        character set (default BINARY)
--commit            Commit after each load via LOAD DATA INFILE
--createdb            Create databases if they don't exist
--csv               Files are in CSV format (implies --tab)
--database      -DLoad all files into this database
--databases       -dRestore only this comma-separated list of databases
--dbregex             Restore only databases whose names match this regex
--decompress          Command used to decompress and print .gz files to STDOUT
                        (like zcat). (default gzip -d -c)
--defaults-file   -FOnly read mysql options from the given file. You must
                        give an absolute pathname.
--disablekeys   Execute ALTER TABLE DISABLE KEYS before each table
--fifo            Stream files into a FIFO for --tab (default yes)
--help                Show this help message
--host            -hConnect to host
--ignore          -iAdds the IGNORE modifier to LOAD DATA INFILE
--ignoredb      -gIgnore this comma-separated list of databases
--ignoretbl       -nIgnore this comma-separated list of table names
--local         -LUses the LOCAL option to LOAD DATA INFILE
--locktables      Lock tables before LOAD DATA INFILE
--noautovalon0    Set SQL NO_AUTO_VALUE_ON_ZERO before LOAD DATA INFILE
--noforeignkeys   Set FOREIGN_KEY_CHECKS=0 before LOAD DATA INFILE
--noresume            Do not resume restore
--nouniquechecksSet UNIQUE_CHECKS=0 before LOAD DATA INFILE
--numthread       -mSpecifies the number of parallel processes to run
--password      -pPassword to use when connecting
--port            -PPort number to use for connection
--progress            Display progress messages
--quiet         -qSets --verbose to 0
--replace         -rAdds the REPLACE modifier to LOAD DATA INFILE
--setvars             Set these MySQL variables (default wait_timeout=10000)
--socket          -SSocket file to use for connection
--tab             -TLoad tab-separated files with LOAD DATA INFILE
--tables          -tRestore only this comma-separated list of table names
--tblregex            Restore only tables whose names match this regex
--test                Print commands instead of executing them
--truncate            Run TRUNCATE TABLE before LOAD DATA INFILE
--umask               Set the program's umask to this octal value
--user            -uUser for login if not current user
--verbose         -vVerbosity; can specify multiple times (default 1)
--version             Output version information and exit
--wait            -wWait limit when server is down (default 5m).Optional
                        suffix s=seconds, m=minutes, h=hours, d=days; if no
                        suffix, s is used.

Options and values after processing arguments:
--askpass             FALSE
--atomicresume      TRUE
--basedir             /root/cron
--biggestfirst      TRUE
--binlog            1
--bulkinsbufsize      (No value)
--charset             BINARY
--commit            FALSE
--createdb            FALSE
--csv               FALSE
--database            (No value)
--databases         (No value)
--dbregex             (No value)
--decompress          gzip -d -c
--defaults-file       (No value)
--disablekeys         FALSE
--fifo                TRUE
--help                TRUE
--host                (No value)
--ignore            FALSE
--ignoredb            
--ignoretbl         
--local               FALSE
--locktables          FALSE
--noautovalon0      FALSE
--noforeignkeys       FALSE
--noresume            FALSE
--nouniquechecks      FALSE
--numthread         4
--password            (No value)
--port                (No value)
--progress            FALSE
--quiet               FALSE
--replace             FALSE
--setvars             wait_timeout=10000
--socket            (No value)
--tab               FALSE
--tables            (No value)
--tblregex            (No value)
--test                FALSE
--truncate            FALSE
--umask               0
--user                (No value)
--verbose             1
--version             FALSE
--wait                300

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/111930/showart_2184933.html
页: [1]
查看完整版本: Mysql管理必备工具Maatkit详解之十(mk-parallel-restore)