首页 > 代码库 > mydumper 0.6.2 安装,dba的必备备份工具,必须掌握

mydumper 0.6.2 安装,dba的必备备份工具,必须掌握

新年第一天,祝愿所有的数据库都平平安安!


直接看安装过程,缺少包的自己看readme 安装好了。

[root@mysql93 local]# tar -xvf mydumper-0.6.2.tar.gz

mydumper-0.6.2/CMakeLists.txt

mydumper-0.6.2/README

mydumper-0.6.2/binlog.c

mydumper-0.6.2/binlog.h

mydumper-0.6.2/cmake/

mydumper-0.6.2/common.h

mydumper-0.6.2/config.h.in

mydumper-0.6.2/docs/

mydumper-0.6.2/g_unix_signal.c

mydumper-0.6.2/g_unix_signal.h

mydumper-0.6.2/mydumper.c

mydumper-0.6.2/mydumper.h

mydumper-0.6.2/myloader.c

mydumper-0.6.2/myloader.h

mydumper-0.6.2/server_detect.c

mydumper-0.6.2/server_detect.h

mydumper-0.6.2/cmake/modules/

mydumper-0.6.2/cmake/modules/CppcheckTargets.cmake

mydumper-0.6.2/cmake/modules/FindGLIB2.cmake

mydumper-0.6.2/cmake/modules/FindMySQL.cmake

mydumper-0.6.2/cmake/modules/FindPCRE.cmake

mydumper-0.6.2/cmake/modules/FindSphinx.cmake

mydumper-0.6.2/cmake/modules/Findcppcheck.cmake

mydumper-0.6.2/cmake/modules/Findcppcheck.cpp

mydumper-0.6.2/docs/CMakeLists.txt

mydumper-0.6.2/docs/_build/

mydumper-0.6.2/docs/_static/

mydumper-0.6.2/docs/authors.rst

mydumper-0.6.2/docs/compiling.rst

mydumper-0.6.2/docs/examples.rst

mydumper-0.6.2/docs/files.rst

mydumper-0.6.2/docs/index.rst

mydumper-0.6.2/docs/mydumper_usage.rst

mydumper-0.6.2/docs/myloader_usage.rst

mydumper-0.6.2/docs/_build/conf.py.in

mydumper-0.6.2/docs/_build/sources.cmake.in

[root@mysql93 local]# ll

总用量 10036

drwxr-xr-x.  2 root root    4096 11月 23 00:06 bin

drwxr-xr-x.  5 root root    4096 11月 18 2015 etc

drwxr-xr-x.  2 root root    4096 9月  23 2011 games

drwxr-xr-x  10 root root    4096 6月   1 2016 inception

drwxr-xr-x.  2 root root    4096 9月  23 2011 include

drwxr-xr-x   2 root root    4096 5月  11 2016 lepus

drwxr-xr-x.  2 root root    4096 9月  23 2011 lib

drwxr-xr-x.  2 root root    4096 9月  23 2011 lib64

drwxr-xr-x.  2 root root    4096 9月  23 2011 libexec

drwxr-xr-x   4 root root    4096 12月 29 22:02 mydumper-0.6.2

-rw-r--r--   1 root root   40165 9月  30 16:33 mydumper-0.6.2.tar.gz

drwxrwxr-x   6 root root    4096 11月 23 03:10 redis-3.0.7

-rw-r--r--   1 root root 1375200 11月 25 10:01 redis-3.0.7.tar.gz

drwxr-xr-x.  2 root root    4096 11月 18 2015 sbin

drwxr-xr-x.  5 root root    4096 8月   3 2015 share

drwxr-xr-x.  3 root root    4096 12月 10 2015 src

[root@mysql93 local]# cd mydumper-0.6.2

[root@mysql93 mydumper-0.6.2]# ll

总用量 140

-rw-r--r-- 1 root root  8171 9月   6 2014 binlog.c

-rw-r--r-- 1 root root  1244 9月   6 2014 binlog.h

drwxr-xr-x 3 root root  4096 12月 29 22:02 cmake

-rw-r--r-- 1 root root  2339 9月   6 2014 CMakeLists.txt

-rw-r--r-- 1 root root  2081 9月   6 2014 common.h

-rw-r--r-- 1 root root   101 9月   6 2014 config.h.in

drwxr-xr-x 4 root root  4096 12月 29 22:02 docs

-rw-r--r-- 1 root root  3614 9月   6 2014 g_unix_signal.c

-rw-r--r-- 1 root root   339 9月   6 2014 g_unix_signal.h

-rw-r--r-- 1 root root 65450 9月   6 2014 mydumper.c

-rw-r--r-- 1 root root  1937 9月   6 2014 mydumper.h

-rw-r--r-- 1 root root 12742 9月   6 2014 myloader.c

-rw-r--r-- 1 root root  1284 9月   6 2014 myloader.h

-rw-r--r-- 1 root root  2458 9月   6 2014 README

-rw-r--r-- 1 root root  2021 9月   6 2014 server_detect.c

-rw-r--r-- 1 root root  1116 9月   6 2014 server_detect.h

[root@mysql93 mydumper-0.6.2]# cmake .

-- The C compiler identification is GNU 4.4.7

-- The CXX compiler identification is GNU 4.4.7

-- Check for working C compiler: /usr/bin/cc

-- Check for working C compiler: /usr/bin/cc -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working CXX compiler: /usr/bin/c++

-- Check for working CXX compiler: /usr/bin/c++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Using mysql-config: /usr/bin/mysql_config

-- Found MySQL: /usr/include/mysql, /usr/lib64/libmysqlclient.so;/usr/lib64/libpthread.so;/usr/lib64/libm.so;/usr/lib64/librt.so;/usr/lib64/libdl.so

-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.3") 

-- Found PkgConfig: /usr/bin/pkg-config (found version "0.23") 

-- checking for one of the modules ‘glib-2.0‘

-- checking for one of the modules ‘gthread-2.0‘

-- checking for module ‘libpcre‘

--   found libpcre, version 7.8

-- Found PCRE: /usr/include  


CMake Warning at docs/CMakeLists.txt:9 (message):

  Unable to find Sphinx documentation generator



-- ------------------------------------------------

-- MYSQL_CONFIG = /usr/bin/mysql_config

-- CMAKE_INSTALL_PREFIX = /usr/local

-- BUILD_DOCS = ON

-- WITH_BINLOG = OFF

-- RUN_CPPCHECK = OFF

-- Change a values with: cmake -D<Variable>=<Value>

-- ------------------------------------------------

-- 

-- Configuring done

-- Generating done

-- Build files have been written to: /usr/local/mydumper-0.6.2

[root@mysql93 mydumper-0.6.2]# make 

Scanning dependencies of target mydumper

[ 25%] Building C object CMakeFiles/mydumper.dir/mydumper.c.o

[ 50%] Building C object CMakeFiles/mydumper.dir/server_detect.c.o

[ 75%] Building C object CMakeFiles/mydumper.dir/g_unix_signal.c.o

Linking C executable mydumper

[ 75%] Built target mydumper

Scanning dependencies of target myloader

[100%] Building C object CMakeFiles/myloader.dir/myloader.c.o

Linking C executable myloader

[100%] Built target myloader

[root@mysql93 mydumper-0.6.2]# make install 

[ 75%] Built target mydumper

[100%] Built target myloader

Install the project...

-- Install configuration: ""

-- Installing: /usr/local/bin/mydumper

-- Installing: /usr/local/bin/myloader

[root@mysql93 mydumper-0.6.2]# 


[root@mysql93 mydumper-0.6.2]# mydumper --help

Usage:

  mydumper [OPTION...] multi-threaded MySQL dumping


Help Options:

  -?, --help                  Show help options


Application Options:

  -B, --database              Database to dump

  -T, --tables-list           Comma delimited table list to dump (does not exclude regex option)

  -o, --outputdir             Directory to output files to

  -s, --statement-size        Attempted size of INSERT statement in bytes, default 1000000

  -r, --rows                  Try to split tables into chunks of this many rows. This option turns off --chunk-filesize

  -F, --chunk-filesize        Split tables into chunks of this output file size. This value is in MB

  -c, --compress              Compress output files

  -e, --build-empty-files     Build dump files even if no data available from table

  -x, --regex                 Regular expression for ‘db.table‘ matching

  -i, --ignore-engines        Comma delimited list of storage engines to ignore

  -m, --no-schemas            Do not dump table schemas with the data

  -k, --no-locks              Do not execute the temporary shared read lock.  WARNING: This will cause inconsistent backups

  --less-locking              Minimize locking time on InnoDB tables.

  -l, --long-query-guard      Set long query timer in seconds, default 60

  -K, --kill-long-queries     Kill long running queries (instead of aborting)

  -D, --daemon                Enable daemon mode

  -I, --snapshot-interval     Interval between each dump snapshot (in minutes), requires --daemon, default 60

  -L, --logfile               Log file name to use, by default stdout is used

  --tz-utc                    SET TIME_ZONE=‘+00:00‘ at top of dump to allow dumping of TIMESTAMP data when a server has data in different time zones or data is being moved between servers with different time zones, defaults to on use --skip-tz-utc to disable.

  --skip-tz-utc               

  --use-savepoints            Use savepoints to reduce metadata locking issues, needs SUPER privilege

  --success-on-1146           Not increment error count and Warning instead of Critical in case of table doesn‘t exist

  --lock-all-tables           Use LOCK TABLE for all, instead of FTWRL

  -h, --host                  The host to connect to

  -u, --user                  Username with privileges to run the dump

  -p, --password              User password

  -P, --port                  TCP/IP port to connect to

  -S, --socket                UNIX domain socket file to use for connection

  -t, --threads               Number of threads to use, default 4

  -C, --compress-protocol     Use compression on the MySQL connection

  -V, --version               Show the program version and exit

  -v, --verbose               Verbosity of output, 0 = silent, 1 = errors, 2 = warnings, 3 = info, default 2


  

  [root@mysql93 mydumper-0.6.2]# 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

  -o, --overwrite-tables            Drop tables if they already exist

  -B, --database                    An alternative database to restore into

  -e, --enable-binlog               Enable binary logging of the restore data

  -h, --host                        The host to connect to

  -u, --user                        Username with privileges to run the dump

  -p, --password                    User password

  -P, --port                        TCP/IP port to connect to

  -S, --socket                      UNIX domain socket file to use for connection

  -t, --threads                     Number of threads to use, default 4

  -C, --compress-protocol           Use compression on the MySQL connection

  -V, --version                     Show the program version and exit

  -v, --verbose                     Verbosity of output, 0 = silent, 1 = errors, 2 = warnings, 3 = info, default 2


[root@mysql93 mydumper-0.6.2]# 



[root@mysql93 db_backup]# mydumper -u root -p root -h 192.168.1.93 -t 8 -o /data/db_backup/fullbak_$(date +%F)

[root@mysql93 db_backup]# myloader -u root -p root -h 192.168.1.93 -t 8 -o -d ./fullbak_2016-12-29/

本文出自 “roidba” 博客,请务必保留此出处http://roidba.blog.51cto.com/12318731/1888005

mydumper 0.6.2 安装,dba的必备备份工具,必须掌握