您好,登錄后才能下訂單哦!
MySQL自身的mysqldump工具支持單線程工作,依次一個個導出多個表,沒有一個并行的機,這就使得它無法迅速的備份數據。
Mydumper作為一個實用工具,能夠良好支持多線程工作,可以并行的多線程的從表中讀入數據并同時寫到不同的文件里,這使得它在處理速度方面快于傳統的mysqldump。其特征之一是在處理過程中需要對列表加以鎖定,因此如果我們需要在工作時段執行備份工作,那么會引起DML阻塞。但一般現在的MySQL都有主從,備份也大部分在從上進行,所以鎖的問題可以不用考慮。這樣,mydumper能更好的完成備份任務。
1. 多線程備份
2. 因為是多線程邏輯備份,備份后會生成多個備份文件
3. 備份時對MyISAM表施加FTWRL(FLUSH TABLES WITH READ LOCK),會阻塞DML語句
4. 保證備份數據的一致性
5. 支持文件壓縮
6. 支持導出binlog
7. 支持多線程恢復
8. 支持以守護進程模式工作,定時快照和連續二進制日志
9. 支持將備份文件切塊
# git clone https://github.com/maxbube/mydumper
# cd mydumper
# less README.md (查看幫助文檔,里面說明了如何編譯安裝以及依賴包)
# yum install glib2-devel zlib-devel pcre-devel openssl-devel cmake
# cmake
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/mydumper
** 出現Configuring done和Generating done說明cmake成功了,如果有報錯,請查看詳細的屏幕輸出日志
# make -j 4
# make install (會把mydumper和myloader安裝在/usr/local/bin/目錄下)
# mydumper
# mydumper --help
mydumper: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory (報錯說明找不到這個共享庫)
# ldd /usr/local/bin/mydumper
linux-vdso.so.1 => (0x00007ffe2aebb000)
libmysqlclient.so.20 => not found
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdf6d0a0000)
libm.so.6 => /lib64/libm.so.6 (0x00007fdf6ce1c000)
librt.so.1 => /lib64/librt.so.1 (0x00007fdf6cc14000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fdf6ca0f000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007fdf6c6f8000)
libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007fdf6c4f4000)
libpcre.so.0 => /lib64/libpcre.so.0 (0x00007fdf6c2c6000)
libz.so.1 => /lib64/libz.so.1 (0x00007fdf6c0b0000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fdf6bdaa000)
libc.so.6 => /lib64/libc.so.6 (0x00007fdf6ba15000)
/lib64/ld-linux-x86-64.so.2 (0x00007fdf6d2c9000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fdf6b7ff000)
# LD_DEBUG=libs /usr/local/bin/mydumper -v
1987: find library=libmysqlclient.so.20 [0]; searching
1987: search cache=/etc/ld.so.cache
1987: search path=/lib64/tls/x86_64:/lib64/tls:/lib64/x86_64:/lib64:/usr/lib64/tls/x86_64:/usr/lib64/tls:/usr/lib64/x86_64:/usr/lib64 (system search path)
1987: trying file=/lib64/tls/x86_64/libmysqlclient.so.20
1987: trying file=/lib64/tls/libmysqlclient.so.20
1987: trying file=/lib64/x86_64/libmysqlclient.so.20
1987: trying file=/lib64/libmysqlclient.so.20
1987: trying file=/usr/lib64/tls/x86_64/libmysqlclient.so.20
1987: trying file=/usr/lib64/tls/libmysqlclient.so.20
1987: trying file=/usr/lib64/x86_64/libmysqlclient.so.20
1987: trying file=/usr/lib64/libmysqlclient.so.20
1987:
/usr/local/bin/mydumper: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory
# locate libmysqlclient.so.20
# ll /usr/local/mysql/lib/
# cp /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib/
# ldconfig
# ldd /usr/local/bin/mydumper
# 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, --omit-from-file File containing a list of database.table entries to skip, one per line (skips before applying 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
-N, --insert-ignore Dump rows with INSERT IGNORE
-m, --no-schemas Do not dump table schemas with the data
-d, --no-data Do not dump table data
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。