Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 2
Backing Up the MySQL Database
Sanjay Manwani
MySQL India Director
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 3
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 4
Program Agenda
Understanding Backup
MySQL Enterprise Backup (MEB)
Backup Strategies
What’s New in MEB 3.9
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 5
Understanding Backup
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 6
Why Backup is important
Audits
Disasters
Is HA setup a backup ?
Is LVM a backup ?
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 7
Types of Backup and Tools for these types
Logical
– Mysqldump
– Mysqldbexport/import
Physical
– MySQL Enterprise Backup (MEB)
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 8
Logical Backup
Advantages
– Easy of use - simple commands allow you to easily backup and restore
– Good for small database or tables – minimum impact on backup and
restore performance
– Flexibility – logical backup allows you to choose what you want to backup
and not backup. Change the scripts to restore partially etc.
– Readability - Good assurance that database files are not corrupt - all the
data is read and it is read using standard SQL queries.
Collection of SQL Queries to recreate the database
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 9
Logical Backup
Disadvantages
– Not an online solution - write operations are locked while performing the
backup, thereby blocking use of the database.
– Poor performance for larger databases – backup and especially restore
times are very slow for larger databases.
– Not consistent – database won’t necessarily be restored to a consistent
state.
– No incremental backup – all backups are full backups, can be time
consuming and require more storage.
Collection of SQL Queries to recreate the database
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 10
Physical Backup (MEB)
Advantages
– Performance –faster for backups and faster for restore
– Flexible – support for incremental backups, partial backups, backup
compression, point in time recovery and more.
– Archival Backups – suitable archival format for historical purposes
– Scalable – performance is near linear for larger databases.
– Consistent – delivers consistent point in time recovery
Copy of the internal files that constitute the MySQL database
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 11
Physical v/s Logical Backup
0
1
2
3
4
5
6
Category 1 Category 2 Category 3 Category 4
Series 1 Series 2 Series 3
Comparison Summary
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 12
MySQL Enterprise Backup
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 13
MEB Backup
Full Backup
Incremental Backup – File based
and Redo log only
Compressed Backup
Backup to Single File/Image
Backup to tape
Partial Backup
What is methods are available to choose from
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 14
MEB – Apply log
InnoDB consists of pages with
information about the LSN
number applicable to the page
Applylog scans the InnoDB redo
log and applies the relavant
changes to the InnoDB page and
upto the correct LSN to be
applied
The intermediate step
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 15
MEB – Recovery
Copyback
New! copyback-and-apply-log
Validate
Recovery is what is important
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 16
MEB Single image manipulation
validate
– Ensure that the checksums are consistent
list image
– Find the files that this image contains
Extract
– Extract files from the image
image-to-backup-dir
– Extract the full image into a directory
backup-dir-to-image
– Convert a backup directory into a image
Manage the backup archive/image
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 17
Some internal performance benchmarks
1.2 TB of Data was generated using TPC-H
Linux 2.6.32-220.2.1.el6.x86_64 OEL6.2/64 32 GB, 8 x 3000 MHz (8), 2X2 TB 2X1TB Disk, 1
Graphs
0 20 40 60 80 100 120
Time (mm:ss)
Avg CPU%
Avg USER%
Avg. SYS%
Avg IOWAIT%
Compressed Image
Compress
Image
Backup
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 18
MEB External Interaction
Tape and Backup Solutions
– Oracle secure backup
– Netbackup
Workbench
– Scheduling
– Monitoring
MySQL Enterprise Monitor
– Advisors
MEB integrates with external products
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 19
SBT Interface Tape and Backup Solutions
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 20
Oracle Secure Backup Tape and Backup Solutions
A general-purpose network
data protection tool that
simplifies and automates
the backup and restore of
files on a file system.
A media management
layer for Recovery
Manager through the SBT
interface.
Integrates with a wide
variety of tertiary devices
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 21
Workbench MEB & Workbench
Integrates with
MEB
Allows setup of
automatic backup
schedules
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 22
Workbench MEB & Workbench
Allows some
options
Keeps information
about backups
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 23
Workbench MEB & Workbench
Helps setup and
validates the
setup
Helps in recovery
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 24
MEM – MySQL Enterprise Monitor
Integrates with MEB
Generates events if
the backup is not
taken within specified
amount of time
MEB advisors in MEM
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 25
MEM
Allows thresholds to be
set
Advises users to backup
within their thresholds
MEB advisors in MEM
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 26
Backup Strategies
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 27
Backup Strategies
Always need to be tailored based on environment
– data growth, read v/s write usage, size of DB, user base, distribution
Based on backup policies of your organization
Account for spurts in data growth
Account for schema modification – Before and after
Needs to take into account quiet periods
Needs to take into account your H/W and storage infrastructure
IMPORTANTLY – Based on your restore requirement
.
A comprehensive plan for backup and recovery
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 28
Example Backup Strategy A comprehensive plan for backup and recovery
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 29
Example Recovery Strategy A comprehensive plan for backup and recovery
Recover log to Full Backup • For past 3 days
Recover Incremental Backup • 3 days to 1 week
Archive Backup • Archive full
backups more than 1 week old to tape.
• Delete backups more than 6 months old
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 30
Validate
No backup strategy is complete without validating backup
Validate by MEB command • Every week
Validate by reinstall • Every
month
Reinstall and run regression • Every 2
months
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 31
What’s New in MEB 3.9
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 32
What’s New in MEB
New! Single Step
– Restore directly.
New! Full Instance
– Config/Settings/…
New! Selective
– Leverages TTS
– Great for large tables
New! Skip Unused Pages
– Reduces space
Continuous progress
– %, Bytes, Status
Monitor disk space
– Optional actions
Warn & Retry, Abort, Remove
Usability, usability usability
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 33
Selective backup with TTS
MySQL 5.6 feature : Transportable Table spaces
– Online table portability : Import/Export
Why use with MEB
– Locking time
– Ease of use
What is TTS, why better than normal partial backup
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 34
Skip Unused pages
InnoDB files don’t shrink
A small DB has many unused pages
There is a performance penalty
Cleaning up before a backup
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 35
References
MySQL Enterprise Backup: Product Information
– www.mysql.com/products/enterprise/backup.html
MySQL Enterprise Backup Team Blog
– https://blogs.oracle.com/mysqlenterprisebackup/
MySQL Enterprise Backup: Documentation
– dev.mysql.com/doc/mysql-enterprise-backup/3.9/en/index.html
How Do I get it
– https://edelivery.oracle.com
Support and patches (My Oracle Support = MOS)
– https://support.oracle.com
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 36
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 37
Graphic Section Divider
Top Related