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

Mini Program to Implement Paging Effect

This article example shares the specific code for...

A brief analysis of MySQL parallel replication

01 The concept of parallel replication In the mas...

How to Completely Clean Your Docker Data

Table of contents Prune regularly Mirror Eviction...

Summary of data interaction between Docker container and host

Preface When using Docker in a production environ...

CSS position fixed left and right double positioning implementation code

CSS Position The position attribute specifies the...

Bootstrap 3.0 study notes CSS related supplement

The main contents of this article are as follows:...

PNG Alpha Transparency in IE6 (Complete Collection)

Many people say that IE6 does not support PNG tra...

Web page text design should be like smart girls wearing clothes

<br />"There are no ugly women in the w...

jQuery plugin to achieve image comparison

This article example shares the specific code of ...

Undo log in MySQL

Concept introduction: We know that the redo log i...

Summary of CSS counter and content

The content property was introduced as early as C...

Detailed tutorial on installing Tomcat9 windows service

1. Preparation 1.1 Download the tomcat compressed...