Backing Up the MySQL Database
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Backing Up the MySQL Database

on

  • 1,123 views

Presentation at MySQL Connect 2013

Presentation at MySQL Connect 2013

Statistics

Views

Total Views
1,123
Views on SlideShare
1,117
Embed Views
6

Actions

Likes
0
Downloads
33
Comments
0

1 Embed 6

http://www.scoop.it 6

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Backing Up the MySQL Database Presentation Transcript

  • 1. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.1
  • 2. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.2 Backing Up the MySQL Database Sanjay Manwani MySQL India Director
  • 3. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.3
  • 4. 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
  • 5. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.5 Understanding Backup
  • 6. 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 ?
  • 7. 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)
  • 8. 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
  • 9. 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
  • 10. 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
  • 11. 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
  • 12. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.12 MySQL Enterprise Backup
  • 13. 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
  • 14. 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
  • 15. 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
  • 16. 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
  • 17. 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
  • 18. 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
  • 19. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.19 SBT Interface Tape and Backup Solutions
  • 20. 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
  • 21. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.21 Workbench MEB & Workbench  Integrates with MEB  Allows setup of automatic backup schedules
  • 22. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.22 Workbench MEB & Workbench  Allows some options  Keeps information about backups
  • 23. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.23 Workbench MEB & Workbench  Helps setup and validates the setup  Helps in recovery
  • 24. 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
  • 25. 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
  • 26. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.26 Backup Strategies
  • 27. 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
  • 28. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.28 Example Backup Strategy A comprehensive plan for backup and recovery
  • 29. 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
  • 30. 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
  • 31. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.31 What’s New in MEB 3.9
  • 32. 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
  • 33. 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
  • 34. 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
  • 35. 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
  • 36. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.36
  • 37. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.37 Graphic Section Divider