SlideShare a Scribd company logo
Backup - Mydumper
Vinoth Kanna RS
Remote DBA
2014-07-13
www.percona.com
Agenda
● Logical Backups
● Backups Locks
● Examples
● Tips
www.percona.com
Logical Backups
● Logical
● Plain text files
● Can be Remote
● Slower on large data-sets
● Sometimes the only option
www.percona.com
Logical Backups
● Tools
● mysqldump
● Mydumper
www.percona.com
Logical Backups
● mysqldump
● General use
● Simple to use
● By default lock tables
● One big output file
● Can be piped to mysql client
www.percona.com
Logical Backups
● mysqldump
● --opt = --add-drop-table --add-locks --create-options
--quick --extended-insert --lock-tables --set-charset
--disable-keys (default)
● --single-transaction (innodb)
● --master-data (FTWRL) for binlog coordinates
● --dump-slave
● --innodb-optimize-keys (PS only feature)
● --triggers (ON) --routines (OFF)
www.percona.com
Logical Backups
● Mydumper
● Faster logical backups as is multithread
● Almost no locking with innodb tables
● Compress on the fly
● Doesn't handle Views, Triggers and Procedures
● Separate files per table, one row per line
www.percona.com
Logical Backups
● Mydumper
● --threads
● --outputdir
● --rows, --chunk-filesize
● --compress
● --less-locking
● --kill-long-queries
● --use-savepoints
www.percona.com
Logical Backups
● Without chunks
Thread 1 Thread 2 Thread 3 Thread 4
0
10
20
30
40
50
60
Table D
Table C
Table B
Table A
Time
www.percona.com
Logical Backups
● With chunks (--rows)
Thread 1 Thread 2 Thread 3 Thread 4
0
5
10
15
20
25
Table D
Table C
Table B
Table A
Time
www.percona.com
Logical Backups
● Mydumper output files
● metadata
Started dump at: 2014-04-18 22:01:30
SHOW MASTER STATUS:
Log: mysql-bin.017436
Pos: 890402821
SHOW SLAVE STATUS:
Host: 192.168.56.101
Log: mysql-bin.017057
Pos: 968001054
Finished dump at: 2014-04-19 03:10:05
www.percona.com
Logical Backups
● Mydumper output files
● database.table.sql
/*!40101 SET NAMES binary*/;
/*!40014 SET FOREIGN_KEY_CHECKS=0*/;
/*!40103 SET TIME_ZONE='+00:00' */;
INSERT INTO `t1` VALUES
(1,"abc"),
(2,"def"),
(4,"abc"),
(5,"abc"),
(6,"abc"),
(7,"abc"),
(8,"abc");
Backup Locks
www.percona.com
Backup Locks
● LOCK TABLE ... READ LOCAL
● Other sessions can read the table but can't write
● LOCAL allows non conflicting INSERTs to MyISAM
● FLUSH TABLES WITH READ LOCK
● Global read lock
● Big issue on busy servers and long running selects
● Requires tables be reopened which can be another bottleneck on busy servers
● metadata locking since 5.5
● No DDLs to tables used in a transaction
www.percona.com
Backup Locks
● mysqldump
● --lock-tables (default)
– LOCK TABLES READ LOCAL
● --lock-all-tables --master-data and --dump-slave
– FLUSH TABLES WITH READ LOCK
● --single-transaction (innodb only)
– START TRANSACTION /*!40100 WITH CONSISTENT SNAPSHOT
*/
● --skip-lock-tables
– No locks
www.percona.com
Backup Locks
● Mydumper
● Always needs FTWRL to coordinate threads but for a
small time if all tables are innodb
● --less-locking
– LOCK TABLES READ LOCAL for non-innodb
– CONSISTENT SNAPSHOT for innodb
● --use-savepoints
– Reduce metadata locking issues
● --no-locks
– Not ensure a consistent backup
www.percona.com
Backup Locks
● Percona Server 5.6 new locks for backups
● Percona XtraBackup 2.2
● Mysqldump --lock-for-backup --single-transaction
● Mydumper 0.6.2
● LOCK TABLES FOR BACKUP
● Block updates to non-transactional tables
● Block DDL to all tables
Examples
www.percona.com
Using Mydumper
● Full Backup:
● pre mydumper
mysqldump -h x.x.x.x -P -d –single-transaction -R –skip-triggers --ignore-create-
error
● mydumper -h x.x.x.x -–less-locking –-compress -o /backup/dir
post_mydumper
● mysqldump -h x.x.x.x -P xxxx -d –single-transaction -t --ignore-create-error
● Full Restore:
myloader -h x.x.x.x -d /backup/dir -o
www.percona.com
Using Mydumper
● Partial Restore:
cd /backup/dir
mkdir restore
cp -l db.* ./restore/
cp -l metadata ./restore/
myloader -h x.x.x.x -d /backup/dir/restore/ -o
Tips
www.percona.com
Tips
● Use the three types of backups
● Binary for full restores, new slaves
● Logical for partial restores
● Binlog for point in time recovery
● Store on more than one server and off-site
● Test your backups!!!!
● Document restore procedures, script them and test them!!!
Percona Backup Service
www.percona.com
Percona Backup Service
● Managed MySQL backup and recovery combining our best practices
and software tools with your backup servers
● Percona ensures your backups run smoothly and reliably
● Backup data sets are always available
● Percona manages production recovery
● Lower TCO than managing in-house
● Any combination of MySQL server and backup locations
● Flexible backup configurations per customer
● More information at www.percona.com
vinoth.kanna@percona.com
We're Hiring! www.percona.com/about-us/careers/
Thank you - Q&A

More Related Content

PDF
TokuDB - What You Need to Know
PDF
MySQL Server Backup, Restoration, and Disaster Recovery Planning
PDF
MySQL Storage Engines Landscape
PPTX
M|18 Writing Stored Procedures in the Real World
PDF
Collaborate 2012 - Administering MySQL for Oracle DBAs
PPTX
Get More Out of MongoDB with TokuMX
PDF
Percona Xtrabackup - Highly Efficient Backups
PPTX
MySQL Architecture and Engine
TokuDB - What You Need to Know
MySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Storage Engines Landscape
M|18 Writing Stored Procedures in the Real World
Collaborate 2012 - Administering MySQL for Oracle DBAs
Get More Out of MongoDB with TokuMX
Percona Xtrabackup - Highly Efficient Backups
MySQL Architecture and Engine

What's hot (20)

PDF
Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...
PPTX
Percona FT / TokuDB
PDF
Key-Value-Stores -- The Key to Scaling?
PPTX
Get More Out of MySQL with TokuDB
PDF
Highly efficient backups with percona xtrabackup
PDF
MySQL on AWS RDS
PDF
PostgreSQL and MySQL
PDF
TokuDB internals / Лесин Владислав (Percona)
PPTX
PostgreSQL as an Alternative to MSSQL
PDF
InnoDB Architecture and Performance Optimization, Peter Zaitsev
PPTX
M|18 Creating a Reference Architecture for High Availability at Nokia
PDF
Linux tuning to improve PostgreSQL performance
PDF
Cassandra vs. Redis
PDF
Ten Reasons Why You Should Prefer PostgreSQL to MySQL
PDF
How to Monitor MySQL
PPT
Backup, restore and repair database in mongo db linux file
PDF
Beyond Postgres: Interesting Projects, Tools and forks
ODP
PostgreSQL Replication in 10 Minutes - SCALE
PDF
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
PDF
2016 jan-pugs-meetup-v9.5-features
Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...
Percona FT / TokuDB
Key-Value-Stores -- The Key to Scaling?
Get More Out of MySQL with TokuDB
Highly efficient backups with percona xtrabackup
MySQL on AWS RDS
PostgreSQL and MySQL
TokuDB internals / Лесин Владислав (Percona)
PostgreSQL as an Alternative to MSSQL
InnoDB Architecture and Performance Optimization, Peter Zaitsev
M|18 Creating a Reference Architecture for High Availability at Nokia
Linux tuning to improve PostgreSQL performance
Cassandra vs. Redis
Ten Reasons Why You Should Prefer PostgreSQL to MySQL
How to Monitor MySQL
Backup, restore and repair database in mongo db linux file
Beyond Postgres: Interesting Projects, Tools and forks
PostgreSQL Replication in 10 Minutes - SCALE
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
2016 jan-pugs-meetup-v9.5-features
Ad

Similar to Mydumper - Vinoth kanna @ MySQL meetup Mumbai (20)

PPTX
MyDUMPER : Faster logical backups and restores
PPTX
MySQL backup and restore performance
PPTX
PL22 - Backup and Restore Performance.pptx
PDF
Lock, Stock and Backup: Data Guaranteed
PDF
MySQL and MariaDB Backups
PDF
MySql 5.7 Backup Script
PPT
My two cents about Mysql backup
PDF
MySQL Enterprise Backup (MEB)
PDF
A Backup Today Saves Tomorrow
PDF
OSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
PDF
MySQL for Oracle DBAs
PPTX
Percona Live London 2014 - MySQL Backup Strategy @ IEDR
PPTX
Percona Xtrabackup Best Practices
PDF
Collaborate2011-XtraBackup Collaborate2011-XtraBackup
PDF
Percona xtrabackup - MySQL Meetup @ Mumbai
PDF
Percona XtraDB Cluster ( Ensure high Availability )
PPTX
PPTX
MySQL Backup Best Practices and Case Study- .ie Continuous Restore Process
PDF
MYSQLCLONE Introduction
DOCX
All types of backups and restore
MyDUMPER : Faster logical backups and restores
MySQL backup and restore performance
PL22 - Backup and Restore Performance.pptx
Lock, Stock and Backup: Data Guaranteed
MySQL and MariaDB Backups
MySql 5.7 Backup Script
My two cents about Mysql backup
MySQL Enterprise Backup (MEB)
A Backup Today Saves Tomorrow
OSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
MySQL for Oracle DBAs
Percona Live London 2014 - MySQL Backup Strategy @ IEDR
Percona Xtrabackup Best Practices
Collaborate2011-XtraBackup Collaborate2011-XtraBackup
Percona xtrabackup - MySQL Meetup @ Mumbai
Percona XtraDB Cluster ( Ensure high Availability )
MySQL Backup Best Practices and Case Study- .ie Continuous Restore Process
MYSQLCLONE Introduction
All types of backups and restore
Ad

More from Karthik .P.R (7)

PPTX
Ansible for large scale deployment
PPT
Scaling MySQL using Fabric
PPT
MySQL HA Percona cluster @ MySQL Meetup Mumbai
PPTX
Percona tool kit for MySQL DBA's
PPT
Mysql from a DBA prespective
PDF
MySQL Storage Engines
PDF
MySQL Query Optimization (Basics)
Ansible for large scale deployment
Scaling MySQL using Fabric
MySQL HA Percona cluster @ MySQL Meetup Mumbai
Percona tool kit for MySQL DBA's
Mysql from a DBA prespective
MySQL Storage Engines
MySQL Query Optimization (Basics)

Recently uploaded (20)

PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
project resource management chapter-09.pdf
PDF
STKI Israel Market Study 2025 version august
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
TLE Review Electricity (Electricity).pptx
PDF
August Patch Tuesday
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
Getting Started with Data Integration: FME Form 101
PDF
Hindi spoken digit analysis for native and non-native speakers
PPT
What is a Computer? Input Devices /output devices
PPTX
1. Introduction to Computer Programming.pptx
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Group 1 Presentation -Planning and Decision Making .pptx
NewMind AI Weekly Chronicles - August'25-Week II
A contest of sentiment analysis: k-nearest neighbor versus neural network
cloud_computing_Infrastucture_as_cloud_p
Zenith AI: Advanced Artificial Intelligence
Developing a website for English-speaking practice to English as a foreign la...
project resource management chapter-09.pdf
STKI Israel Market Study 2025 version august
Getting started with AI Agents and Multi-Agent Systems
1 - Historical Antecedents, Social Consideration.pdf
TLE Review Electricity (Electricity).pptx
August Patch Tuesday
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
observCloud-Native Containerability and monitoring.pptx
Getting Started with Data Integration: FME Form 101
Hindi spoken digit analysis for native and non-native speakers
What is a Computer? Input Devices /output devices
1. Introduction to Computer Programming.pptx
OMC Textile Division Presentation 2021.pptx
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game

Mydumper - Vinoth kanna @ MySQL meetup Mumbai

  • 1. Backup - Mydumper Vinoth Kanna RS Remote DBA 2014-07-13
  • 2. www.percona.com Agenda ● Logical Backups ● Backups Locks ● Examples ● Tips
  • 3. www.percona.com Logical Backups ● Logical ● Plain text files ● Can be Remote ● Slower on large data-sets ● Sometimes the only option
  • 5. www.percona.com Logical Backups ● mysqldump ● General use ● Simple to use ● By default lock tables ● One big output file ● Can be piped to mysql client
  • 6. www.percona.com Logical Backups ● mysqldump ● --opt = --add-drop-table --add-locks --create-options --quick --extended-insert --lock-tables --set-charset --disable-keys (default) ● --single-transaction (innodb) ● --master-data (FTWRL) for binlog coordinates ● --dump-slave ● --innodb-optimize-keys (PS only feature) ● --triggers (ON) --routines (OFF)
  • 7. www.percona.com Logical Backups ● Mydumper ● Faster logical backups as is multithread ● Almost no locking with innodb tables ● Compress on the fly ● Doesn't handle Views, Triggers and Procedures ● Separate files per table, one row per line
  • 8. www.percona.com Logical Backups ● Mydumper ● --threads ● --outputdir ● --rows, --chunk-filesize ● --compress ● --less-locking ● --kill-long-queries ● --use-savepoints
  • 9. www.percona.com Logical Backups ● Without chunks Thread 1 Thread 2 Thread 3 Thread 4 0 10 20 30 40 50 60 Table D Table C Table B Table A Time
  • 10. www.percona.com Logical Backups ● With chunks (--rows) Thread 1 Thread 2 Thread 3 Thread 4 0 5 10 15 20 25 Table D Table C Table B Table A Time
  • 11. www.percona.com Logical Backups ● Mydumper output files ● metadata Started dump at: 2014-04-18 22:01:30 SHOW MASTER STATUS: Log: mysql-bin.017436 Pos: 890402821 SHOW SLAVE STATUS: Host: 192.168.56.101 Log: mysql-bin.017057 Pos: 968001054 Finished dump at: 2014-04-19 03:10:05
  • 12. www.percona.com Logical Backups ● Mydumper output files ● database.table.sql /*!40101 SET NAMES binary*/; /*!40014 SET FOREIGN_KEY_CHECKS=0*/; /*!40103 SET TIME_ZONE='+00:00' */; INSERT INTO `t1` VALUES (1,"abc"), (2,"def"), (4,"abc"), (5,"abc"), (6,"abc"), (7,"abc"), (8,"abc");
  • 14. www.percona.com Backup Locks ● LOCK TABLE ... READ LOCAL ● Other sessions can read the table but can't write ● LOCAL allows non conflicting INSERTs to MyISAM ● FLUSH TABLES WITH READ LOCK ● Global read lock ● Big issue on busy servers and long running selects ● Requires tables be reopened which can be another bottleneck on busy servers ● metadata locking since 5.5 ● No DDLs to tables used in a transaction
  • 15. www.percona.com Backup Locks ● mysqldump ● --lock-tables (default) – LOCK TABLES READ LOCAL ● --lock-all-tables --master-data and --dump-slave – FLUSH TABLES WITH READ LOCK ● --single-transaction (innodb only) – START TRANSACTION /*!40100 WITH CONSISTENT SNAPSHOT */ ● --skip-lock-tables – No locks
  • 16. www.percona.com Backup Locks ● Mydumper ● Always needs FTWRL to coordinate threads but for a small time if all tables are innodb ● --less-locking – LOCK TABLES READ LOCAL for non-innodb – CONSISTENT SNAPSHOT for innodb ● --use-savepoints – Reduce metadata locking issues ● --no-locks – Not ensure a consistent backup
  • 17. www.percona.com Backup Locks ● Percona Server 5.6 new locks for backups ● Percona XtraBackup 2.2 ● Mysqldump --lock-for-backup --single-transaction ● Mydumper 0.6.2 ● LOCK TABLES FOR BACKUP ● Block updates to non-transactional tables ● Block DDL to all tables
  • 19. www.percona.com Using Mydumper ● Full Backup: ● pre mydumper mysqldump -h x.x.x.x -P -d –single-transaction -R –skip-triggers --ignore-create- error ● mydumper -h x.x.x.x -–less-locking –-compress -o /backup/dir post_mydumper ● mysqldump -h x.x.x.x -P xxxx -d –single-transaction -t --ignore-create-error ● Full Restore: myloader -h x.x.x.x -d /backup/dir -o
  • 20. www.percona.com Using Mydumper ● Partial Restore: cd /backup/dir mkdir restore cp -l db.* ./restore/ cp -l metadata ./restore/ myloader -h x.x.x.x -d /backup/dir/restore/ -o
  • 21. Tips
  • 22. www.percona.com Tips ● Use the three types of backups ● Binary for full restores, new slaves ● Logical for partial restores ● Binlog for point in time recovery ● Store on more than one server and off-site ● Test your backups!!!! ● Document restore procedures, script them and test them!!!
  • 24. www.percona.com Percona Backup Service ● Managed MySQL backup and recovery combining our best practices and software tools with your backup servers ● Percona ensures your backups run smoothly and reliably ● Backup data sets are always available ● Percona manages production recovery ● Lower TCO than managing in-house ● Any combination of MySQL server and backup locations ● Flexible backup configurations per customer ● More information at www.percona.com