Comparison of mydumper and mysqldump in mysql

Comparison of mydumper and mysqldump in mysql

If you only want to back up a few tables or a single database, mysqldump and mydumper are more convenient than innobackup. However, mydumper has relatively more features, such as multi-threaded backup, regular matching backup, grouping and self-checking. In addition, mydumper and mysqldump are essentially the same in exporting logical data, and do not support online hot backup of innodb. Of course, we can also use innobackup to back up some table data, but it is not the same backup method as mydumper and mysqldump, so the following only tests the use between mydumper and mysqldump.

mydumper export

Use the mydumper tool to export the test (9.4G) data with 8 threads and compress it, as shown below:
mydumper -B test --regex 'test.*' -c -e -G -E -R --use-savepoints -h 10.0.21.5 -u root -P 3301 -p xxxxxx -t 8 -o /data/mysql_bak/

In the directory /data/mysql_bak, each table in the database is saved as two files: table definition and data.

The overall execution time is as follows, a total of 123s

# cat metadata 
Started dump at: 2017-05-19 10:48:00
SHOW MASTER STATUS:
  Log: mysql-bin.000406
  Pos: 2165426
  GTID: (null)

SHOW SLAVE STATUS:
  Host: 10.144.127.4
  Log: mysql-bin.000419
  Pos: 506000361
  GTID: (null)

Finished dump at: 2017-05-19 10:50:03

mysqldump export

Use the default mysqldump tool to export the repository and compress it, as follows:

# time mysqldump -B test -E -R -h 10.0.21.5 -u root -P 3301 -p | gzip >/data/test.sql.gz
Enter password: 

real 3m19.805s
user 4m47.334s
sys 0m10.395s

The real line shows that the entire running time of mysqldump is 199.8s

Summarize

In general, due to the small amount of data, the time difference between mysqldump and mydumper is not large. Most of the time is spent on data transmission. If the database is large enough, the advantage of mydumper can be reflected. In addition, due to the changes in the syntax of the higher version of MySQL, the lower version of mydumper will have export errors, such as the following error:

** (mydumper:18758): CRITICAL **: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': You have an error in your SQL syntax; 
check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_QUOTE_SHOW_CREATE=1' 
at line 1 (1064)

To solve this problem, you can use a higher version of mydumper. If this problem still exists in the higher version, you can refer to the official code on github and make corresponding code modifications.

You may also be interested in:
  • PHP scheduled backup MySQL and mysqldump syntax parameters detailed
  • Things to note when backing up data with mysqldump plus the -w parameter
  • Detailed explanation of mysqldump database backup parameters
  • Implementation of MySQL5.7 mysqldump backup and recovery
  • Summary of MySql import and export methods using mysqldump
  • Detailed explanation of the use of MySQL mysqldump
  • Docker uses the mysqldump command to back up and export mysql data in the project
  • MySQL data migration using MySQLdump command
  • Detailed explanation of Linux mysqldump exporting database, data, and table structure
  • Detailed discussion on the issue of mysqldump data export
  • Instances of excluding certain libraries when backing up the database with mysqldump
  • A brief discussion on how to use mysqldump (MySQL database backup and recovery)
  • mysqldump parameters you may not know

<<:  Analysis and solution of data loss during Vue component value transfer

>>:  Implementation of crawler Scrapy image created by dockerfile based on alpine

Recommend

js object to achieve data paging effect

This article example shares the specific code of ...

How to install and configure the Apache Web server

Learn how to host your own website on Apache, a r...

Use the CSS border-radius property to set the arc

Phenomenon: Change the div into a circle, ellipse...

Implementation of nested jump of vue routing view router-view

Table of contents 1. Modify the app.vue page 2. C...

JavaScript implements asynchronous acquisition of form data

This article example shares the specific code for...

A brief discussion on the Linux kernel's support for floating-point operations

Currently, most CPUs support floating-point units...

The perfect solution for Vue routing fallback (vue-route-manager)

Table of contents Routing Manager background gett...

How to mount a disk in Linux

When using a virtual machine, you may find that t...

A brief explanation of the reasonable application of table and div in page design

At the beginning of this article, I would like to ...

WeChat applet realizes the effect of shaking the sieve

This article shares the specific code of the WeCh...

Javascript to achieve the drag effect of the login box

This article shares the specific code of Javascri...

Solution to 700% CPU usage of Linux process that cannot be killed

Table of contents 1. Problem Discovery 2. View de...

mysql trigger creation and usage examples

Table of contents What is a trigger Create a trig...

jQuery implements form validation

Use jQuery to implement form validation, for your...

Encapsulate the navigation bar component with Vue

Preface: Fully encapsulating a functional module ...