Sie sind auf Seite 1von 37

1 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Backing Up the MySQL


Database
Sanjay Manwani
MySQL India Director

2 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


3 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Program Agenda

 Understanding Backup
 MySQL Enterprise Backup (MEB)
 Backup Strategies
 What’s New in MEB 3.9

4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Understanding Backup

5 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Why Backup is important

 Audits

 Disasters

 Is HA setup a backup ?

 Is LVM a backup ?

6 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Types of Backup and Tools for these types

 Logical
– Mysqldump

– Mysqldbexport/import

 Physical

– MySQL Enterprise Backup (MEB)

7 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Logical Backup
Collection of SQL Queries to recreate the database

 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.

8 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Logical Backup
Collection of SQL Queries to recreate the database

 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.

9 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Physical Backup (MEB)
Copy of the internal files that constitute the MySQL database

 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

10 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Comparison Summary

Physical v/s Logical 3

Backup 2

0
Category 1 Category 2 Category 3 Category 4

Series 1 Series 2 Series 3

11 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


MySQL Enterprise Backup

12 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


MEB Backup
What is methods are available to choose from

 Full Backup
 Incremental Backup – File based
and Redo log only
 Compressed Backup
 Backup to Single File/Image
 Backup to tape
 Partial Backup

13 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


MEB – Apply log
The intermediate step

 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

14 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


MEB – Recovery
Recovery is what is important

 Copyback

 New! copyback-and-apply-log

 Validate

15 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


MEB Single image manipulation
Manage the backup archive/image
 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

16 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Some internal performance benchmarks
Graphs

Avg IOWAIT%

Avg. SYS%

Compressed Image
Avg USER% Compress
Image
Backup
Avg CPU%

Time (mm:ss)

0 20 40 60 80 100 120

 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

17 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


MEB External Interaction
MEB integrates with external products
 Tape and Backup Solutions
– Oracle secure backup
– Netbackup
 Workbench
– Scheduling
– Monitoring
 MySQL Enterprise Monitor
– Advisors

18 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


SBT Interface
Tape and Backup Solutions

19 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


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
20 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Workbench
MEB & Workbench

 Integrates with
MEB
 Allows setup of
automatic backup
schedules

21 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Workbench
MEB & Workbench

 Allows some
options
 Keeps information
about backups

22 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Workbench
MEB & Workbench

 Helps setup and


validates the
setup

 Helps in recovery

23 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


MEM – MySQL Enterprise Monitor
MEB advisors in MEM
 Integrates with MEB
 Generates events if
the backup is not
taken within specified
amount of time

24 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


MEM
MEB advisors in MEM
 Allows thresholds to be
set
 Advises users to backup
within their thresholds

25 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Backup Strategies

26 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Backup Strategies
A comprehensive plan for backup and recovery

 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
.
27 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Example Backup Strategy
A comprehensive plan for backup and recovery

28 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Example Recovery Strategy
A comprehensive plan for backup and recovery

Archive
Backup
Recover • Archive full
Incremental backups more
Recover Backup than 1 week old
to tape.
log to Full • 3 days to 1 week • Delete backups
Backup more than 6
months old
• For past 3 days

29 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Validate
No backup strategy is complete without validating backup

Validate Validate Reinstall


by MEB by and run
command reinstall regression
• Every week • Every • Every 2
month months

30 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


What’s New in MEB 3.9

31 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


What’s New in MEB
Usability, usability usability
 New! Single Step  New! Skip Unused Pages
– Restore directly. – Reduces space

 New! Full Instance  Continuous progress


– Config/Settings/… – %, Bytes, Status

 New! Selective  Monitor disk space


– Leverages TTS – Optional actions

– Great for large tables  Warn & Retry, Abort, Remove

32 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Selective backup with TTS
What is TTS, why better than normal partial backup

 MySQL 5.6 feature : Transportable Table spaces


– Online table portability : Import/Export

 Why use with MEB


– Locking time
– Ease of use

33 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Skip Unused pages
Cleaning up before a backup

 InnoDB files don’t shrink

 A small DB has many unused pages

 There is a performance penalty

34 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


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

35 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


36 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Graphic Section Divider

37 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Das könnte Ihnen auch gefallen