Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use mydumper, a sharp weapon for mysql logical backup

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

How to use mydumper, a sharp tool for mysql logical backup, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a simpler and easier way.

Decompression

Mydumper-master.zip

# unzip mydumper-master.zip

# mv mydumper-master / usr/local/mydumper

# cd / usr/local/mydumper

# yum-y install glib2-devel mysql-devel zlib-devel pcre-devel gcc gcc-c++ cmake make

# cmake.

# make & & make install

Error resolution

# mydumper-help

Mydumper: error while loading shared libraries: libperconaserverclient.so.20: cannot open shared object file: No such file or directory

# ldd / usr/local/bin/mydumper

Linux-vdso.so.1 = > (0x00007ffd3bf7a000)

Libperconaserverclient.so.20 = > not found

Libpthread.so.0 = > / lib64/libpthread.so.0 (0x00007f1994886000)

Libz.so.1 = > / lib64/libz.so.1 (0x00007f1994670000)

Libm.so.6 = > / lib64/libm.so.6 (0x00007f199436e000)

Librt.so.1 = > / lib64/librt.so.1 (0x00007f1994165000)

Libssl.so.10 = > / lib64/libssl.so.10 (0x00007f1993ef8000)

Libcrypto.so.10 = > / lib64/libcrypto.so.10 (0x00007f1993b11000)

Libdl.so.2 = > / lib64/libdl.so.2 (0x00007f199390c000)

Libglib-2.0.so.0 = > / lib64/libglib-2.0.so.0 (0x00007f19935d5000)

Libgthread-2.0.so.0 = > / lib64/libgthread-2.0.so.0 (0x00007f19933d3000)

Libpcre.so.1 = > / lib64/libpcre.so.1 (0x00007f1993171000)

Libc.so.6 = > / lib64/libc.so.6 (0x00007f1992db0000)

/ lib64/ld-linux-x86-64.so.2 (0x00007f1994ab8000)

Libgssapi_krb5.so.2 = > / lib64/libgssapi_krb5.so.2 (0x00007f1992b64000)

Libkrb5.so.3 = > / lib64/libkrb5.so.3 (0x00007f199287e000)

Libcom_err.so.2 = > / lib64/libcom_err.so.2 (0x00007f199267a000)

Libk5crypto.so.3 = > / lib64/libk5crypto.so.3 (0x00007f1992448000)

Libkrb5support.so.0 = > / lib64/libkrb5support.so.0 (0x00007f1992238000)

Libkeyutils.so.1 = > / lib64/libkeyutils.so.1 (0x00007f1992034000)

Libresolv.so.2 = > / lib64/libresolv.so.2 (0x00007f1991e1a000)

Libselinux.so.1 = > / lib64/libselinux.so.1 (0x00007f1991bf4000)

Liblzma.so.5 = > / lib64/liblzma.so.5 (0x00007f19919cf000)

# cp / usr/local/mysql/lib/libperconaserverclient.so.20.3.4 / usr/lib/

# ldconfig-v

Generally speaking, the files of the lib library cannot be found. Just find and cp to / usr/lib/.

Backup (compressed backup files can be directly restored)

# mydumper-u root-p root-S / data/mysql/mysql3306/tmp/mysql3306.sock-c-B reptest-o / backup/01

Mydumper parameter

-B,-- the database to be backed up by database. If not specified, all libraries will be backed up.

-T,-- tables that tables-list needs to back up, with names separated by commas

-o,-- outputdir backup file output directory

-s,-- the number of bytes of insert statements generated by statement-size. Default is 1000000.

-r,-- when rows divides the table into rows, the specified number of block rows. Specifying this option turns off-- chunk-filesize

-F,-- when chunk-filesize divides the table into blocks by size, the specified block size, in MB

-c,-- compress compressed output file

-e,-- build-empty-files if the table data is empty, or generate an empty file (default is no data, only table structure files)

-x,-- regex is the same as regular expression matching 'db.table'

-I,-- ignore-engines ignored storage engine, split with both thicknesses

-m,-- no-schemas does not back up the table structure

-k,-- no-locks does not use temporary shared read-only locks, using this option will cause data inconsistency

-- less-locking reduces the time it takes to impose locks on InnoDB tables (the mechanism of this mode is described in more detail below)

-l,-- long-query-guard sets the long query timeout for blocking backups (in seconds). The default is 60 seconds (default mydumper will exit after timeout)

-- kill-long-queries kills long query (does not quit)

-D,-- daemon enables daemon mode, which backs up the database uninterruptedly at some interval

-I,-- snapshot-interval dump snapshot interval. Default is 60s, which needs to be in daemon mode.

-L,-- the log file name used by logfile (logs generated by mydumper). Standard output is used by default.

-- tz-utc is an option used across time zones, which is not explained.

-- skip-tz-utc ditto

-- use-savepoints uses savepoints to reduce the lock time caused by collecting metadata, which requires SUPER permission

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

-h,-- hostname of the host connection

-u,-- the user used for user backup

-p,-- password password

-P,-- port port

-S,-- socket file when socket uses socket to communicate

-t,-- the number of backup threads enabled by threads. The default is 4.

-C,-- compress-protocol compresses the data communicated with mysql

-V,-- version displays the version number

-v,-- verbose output information mode, 0 = silent, 1 = errors, 2 = warnings, 3 = info, default is 2

Restore

# myloader-u root-p root-S / data/mysql/mysql3306/tmp/mysql3306.sock-B reptest-o-d / backup/01

Myloader usage parameters

-d,-- folder for directory backup files

-Q,-- queries-per-transaction the number of queries executed per transaction. Default is 1000.

-o,-- overwrite-tables if the table to be restored exists, drop the table first, use this parameter, and back up the table structure when you need to back up

-B,-- the database that database needs to restore

-e,-- enable-binlog enables binary logging of restored data

-h,-- host host

-u,-- user restored user

-p,-- password password

-P,-- port port

-S,-- socket socket file

-t,-- the number of threads used by threads restore. Default is 4.

-C-- compress-protocol compression protocol

-V,-- version display version

-v,-- verbose output mode, 0 = silent, 1 = errors, 2 = warnings, 3 = info, default is 2

The answer to the question about how to use mydumper, a sharp tool for mysql logical backup, is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 262

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report