Anda di halaman 1dari 5

https://2bits.com/backup/fast-parallel-mysql-backups-and-imports-mydumper.

html

Install mydumper

https://launchpad.net/mydumper

wget https://launchpad.net/mydumper/0.9/0.9.1/+download/mydumper-0.9.1.tar.gz

tar -xzvf mydumper-0.9.1.tar.gz

cd mydumper-0.9.1

[root@tpaqaci1 mydumper-0.9.1]# ll
total 168
-rw-r--r-- 1 root root 8171 Nov 6 2015 binlog.c
-rw-r--r-- 1 root root 1244 Nov 6 2015 binlog.h
drwxr-xr-x 3 root root 20 Oct 16 14:15 cmake
-rw-r--r-- 1 root root 2339 Nov 6 2015 CMakeLists.txt
-rw-r--r-- 1 root root 2081 Nov 6 2015 common.h
-rw-r--r-- 1 root root 101 Nov 6 2015 config.h.in
drwxr-xr-x 4 root root 4096 Oct 16 14:15 docs
-rw-r--r-- 1 root root 3614 Nov 6 2015 g_unix_signal.c
-rw-r--r-- 1 root root 339 Nov 6 2015 g_unix_signal.h
-rw-r--r-- 1 root root 92941 Nov 6 2015 mydumper.c
-rw-r--r-- 1 root root 2169 Nov 6 2015 mydumper.h
-rw-r--r-- 1 root root 16630 Nov 6 2015 myloader.c
-rw-r--r-- 1 root root 1284 Nov 6 2015 myloader.h
-rw-r--r-- 1 root root 2244 Nov 6 2015 README
-rw-r--r-- 1 root root 2021 Nov 6 2015 server_detect.c
-rw-r--r-- 1 root root 1116 Nov 6 2015 server_detect.h
[root@tpaqaci1 mydumper-0.9.1]#

yum install glib2-devel mysql-devel zlib-devel pcre-devel


yum install cmake
yum install python-sphinx

[root@tpaqaci1 mydumper-0.9.1]# cmake .


-- Using mysql-config: /bin/mysql_config
-- Found MySQL: /usr/include/mysql,
/usr/lib64/mysql/libmysqlclient.so;/usr/lib64/libpthread.so;/usr/lib64/libz.so;/usr
/lib64/libm.so;/usr/lib64/librt.so;/usr/lib64/libssl.so;/usr/lib64/libcrypto.so;/us
r/lib64/libdl.so
1
-- ------------------------------------------------
-- MYSQL_CONFIG = /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: /opt/mydumper-0.9.1

[root@tpaqaci1 mydumper-0.9.1]# ll
total 212
-rw-r--r-- 1 root root 8171 Nov 6 2015 binlog.c
-rw-r--r-- 1 root root 1244 Nov 6 2015 binlog.h
drwxr-xr-x 3 root root 20 Oct 16 14:15 cmake
-rw-r--r-- 1 root root 19582 Oct 16 14:48 CMakeCache.txt
drwxr-xr-x 7 root root 4096 Oct 16 14:48 CMakeFiles
-rw-r--r-- 1 root root 3644 Oct 16 14:45 cmake_install.cmake
-rw-r--r-- 1 root root 2339 Nov 6 2015 CMakeLists.txt
-rw-r--r-- 1 root root 2081 Nov 6 2015 common.h
-rw-r--r-- 1 root root 92 Oct 16 14:42 config.h
-rw-r--r-- 1 root root 101 Nov 6 2015 config.h.in
drwxr-xr-x 5 root root 4096 Oct 16 14:48 docs
-rw-r--r-- 1 root root 3614 Nov 6 2015 g_unix_signal.c
-rw-r--r-- 1 root root 339 Nov 6 2015 g_unix_signal.h
-rw-r--r-- 1 root root 11094 Oct 16 14:48 Makefile
-rw-r--r-- 1 root root 92941 Nov 6 2015 mydumper.c
-rw-r--r-- 1 root root 2169 Nov 6 2015 mydumper.h
-rw-r--r-- 1 root root 16630 Nov 6 2015 myloader.c
-rw-r--r-- 1 root root 1284 Nov 6 2015 myloader.h
-rw-r--r-- 1 root root 2244 Nov 6 2015 README
-rw-r--r-- 1 root root 2021 Nov 6 2015 server_detect.c
-rw-r--r-- 1 root root 1116 Nov 6 2015 server_detect.h

[root@tpaqaci1 mydumper-0.9.1]# make


Scanning dependencies of target mydumper
[ 16%] Building C object CMakeFiles/mydumper.dir/mydumper.c.o
[ 33%] Building C object CMakeFiles/mydumper.dir/server_detect.c.o
[ 50%] Building C object CMakeFiles/mydumper.dir/g_unix_signal.c.o
Linking C executable mydumper
[ 50%] Built target mydumper
Scanning dependencies of target myloader
[ 66%] Building C object CMakeFiles/myloader.dir/myloader.c.o
Linking C executable myloader
[ 66%] Built target myloader
Scanning dependencies of target doc_sources
[ 66%] Built target doc_sources
Scanning dependencies of target doc_html
[ 83%] Building HTML documentation with Sphinx
Making output directory...
[ 83%] Built target doc_html
Scanning dependencies of target doc_man
[100%] Building manual page with Sphinx
Making output directory...
[100%] Built target doc_man

[root@tpaqaci1 mydumper-0.9.1]# make install


[ 50%] Built target mydumper
[ 66%] Built target myloader
[ 66%] Built target doc_sources
[ 83%] Building HTML documentation with Sphinx
[ 83%] Built target doc_html
[100%] Building manual page with Sphinx
[100%] Built target doc_man
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/mydumper
-- Removed runtime path from "/usr/local/bin/mydumper"
-- Installing: /usr/local/bin/myloader
-- Removed runtime path from "/usr/local/bin/myloader"
-- Installing: /usr/local/share/doc/mydumper
-- Installing: /usr/local/share/doc/mydumper/authors.rst
-- Installing: /usr/local/share/doc/mydumper/compiling.rst
-- Installing: /usr/local/share/doc/mydumper/examples.rst
-- Installing: /usr/local/share/doc/mydumper/files.rst
-- Installing: /usr/local/share/doc/mydumper/index.rst
-- Installing: /usr/local/share/doc/mydumper/mydumper_usage.rst
-- Installing: /usr/local/share/doc/mydumper/myloader_usage.rst
-- Installing: /usr/local/share/doc/mydumper/html
-- Installing: /usr/local/share/doc/mydumper/html/authors.html
-- Installing: /usr/local/share/doc/mydumper/html/_sources
-- Installing: /usr/local/share/doc/mydumper/html/_sources/authors.txt
-- Installing: /usr/local/share/doc/mydumper/html/_sources/compiling.txt
-- Installing: /usr/local/share/doc/mydumper/html/_sources/examples.txt
-- Installing: /usr/local/share/doc/mydumper/html/_sources/files.txt
-- Installing: /usr/local/share/doc/mydumper/html/_sources/index.txt
-- Installing: /usr/local/share/doc/mydumper/html/_sources/mydumper_usage.txt
-- Installing: /usr/local/share/doc/mydumper/html/_sources/myloader_usage.txt
-- Installing: /usr/local/share/doc/mydumper/html/compiling.html
-- Installing: /usr/local/share/doc/mydumper/html/examples.html
-- Installing: /usr/local/share/doc/mydumper/html/files.html
-- Installing: /usr/local/share/doc/mydumper/html/index.html
-- Installing: /usr/local/share/doc/mydumper/html/mydumper_usage.html
-- Installing: /usr/local/share/doc/mydumper/html/myloader_usage.html
-- Installing: /usr/local/share/doc/mydumper/html/genindex.html
-- Installing: /usr/local/share/doc/mydumper/html/search.html
-- Installing: /usr/local/share/doc/mydumper/html/_static
-- Installing: /usr/local/share/doc/mydumper/html/_static/pygments.css
-- Installing: /usr/local/share/doc/mydumper/html/_static/ajax-loader.gif
-- Installing: /usr/local/share/doc/mydumper/html/_static/basic.css
-- Installing: /usr/local/share/doc/mydumper/html/_static/comment-bright.png
-- Installing: /usr/local/share/doc/mydumper/html/_static/comment-close.png
-- Installing: /usr/local/share/doc/mydumper/html/_static/comment.png
-- Installing: /usr/local/share/doc/mydumper/html/_static/doctools.js
-- Installing: /usr/local/share/doc/mydumper/html/_static/down-pressed.png
-- Installing: /usr/local/share/doc/mydumper/html/_static/down.png
-- Installing: /usr/local/share/doc/mydumper/html/_static/file.png
-- Installing: /usr/local/share/doc/mydumper/html/_static/jquery.js
-- Installing: /usr/local/share/doc/mydumper/html/_static/minus.png
-- Installing: /usr/local/share/doc/mydumper/html/_static/plus.png
-- Installing: /usr/local/share/doc/mydumper/html/_static/searchtools.js
-- Installing: /usr/local/share/doc/mydumper/html/_static/underscore.js
-- Installing: /usr/local/share/doc/mydumper/html/_static/up-pressed.png
-- Installing: /usr/local/share/doc/mydumper/html/_static/up.png
-- Installing: /usr/local/share/doc/mydumper/html/_static/websupport.js
-- Installing: /usr/local/share/doc/mydumper/html/_static/default.css
-- Installing: /usr/local/share/doc/mydumper/html/_static/sidebar.js
-- Installing: /usr/local/share/doc/mydumper/html/.buildinfo
-- Installing: /usr/local/share/doc/mydumper/html/searchindex.js
-- Installing: /usr/local/share/doc/mydumper/html/objects.inv
-- Installing: /usr/local/share/man/man1/mydumper.1
-- Installing: /usr/local/share/man/man1/myloader.1

[root@tpaqaci1 mydumper-0.9.1]# /usr/local/bin/mydumper --version


mydumper 0.9.1, built against MySQL 5.7.19-17
[root@tpaqaci1 mydumper-0.9.1]# ls -l /usr/local/bin/mydumper
-rwxr-xr-x 1 root root 241408 Oct 16 14:56 /usr/local/bin/mydumper
[root@tpaqaci1 mydumper-0.9.1]#

# Symlink executables to /usr/bin.

[root@tpaqaci1 mydumper-0.9.1]# ln -s /usr/local/bin/mydumper /usr/bin/mydumper

[root@tpaqaci1 mydumper-0.9.1]# ls -l /usr/bin/mydumper


lrwxrwxrwx 1 root root 23 Oct 16 15:04 /usr/bin/mydumper -> /usr/local/bin/mydumper

[root@tpaqaci1 mydumper-0.9.1]# mydumper --version


mydumper 0.9.1, built against MySQL 5.7.19-17
[root@tpaqaci1 mydumper-0.9.1]#

[root@tpaqaci1 mydumper-0.9.1]# mydumper --help


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

http://www.sphinx-doc.org/en/stable/install.html

Running a backup:

http://www.ubuntugeek.com/mydumper-mysql-database-backup-tool.html

http://prog3.com/sbdm/blog/leshami/article/details/46815553

http://prog3.com/sbdm/blog/leshami/article/details/46815553

mydumper RPM now available for CentOS/RHEL 6 and 7:

https://planet.mysql.com/entry/?id=5991079

Also add myloader to path:

/usr/local/bin/myloader

ln -s /usr/local/bin/myloader /usr/bin/myloader

[root@tpaqaci1 opt]# ln -s /usr/local/bin/myloader /usr/bin/myloader


[root@tpaqaci1 opt]# ls -l /usr/bin/myloader
lrwxrwxrwx 1 root root 23 Oct 17 19:33 /usr/bin/myloader -> /usr/local/bin/myloader
[root@tpaqaci1 opt]# 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
-s, --source-db Database to restore
-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@tpaqaci1 opt]# time myloader --database=clarity_production --user=sefange


--host=tpaqaci1 --password=sefange --port=3306 --directory=/mnt/data/backups
--threads=12 --compress-protocol > restore.log

Anda mungkin juga menyukai