mysql enterprise backup apr 2016
TRANSCRIPT
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
MySQL Enterprise Backup
Ted Wennmark, MySQL solution architect [email protected]
Oracle Confidential – Internal/Restricted/Highly Restricted 2
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Why backups?
• Data is your most valuable IP. You hate to protect it from loss
• Disaster Recovery
• Hardware, Software, Developer or DBA error
• Migration and Upgrades – Change Hardware
• Create replica’ s for HA setup
• Archival – requirements to keep data for X number of years
• Move chunks of data
• Setup Test Environments
Oracle Confidential – Internal/Restricted/Highly Restricted 3
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Backup and Recovery can be trickier than it appears
Requires some fore thought and planning
• How do you backup your critical production systems?
• While servers are performing critical business functions
• And downtown is not acceptable
• Where negative performance impacts are not acceptable
• Finding proper backup storage is critical
Oracle Confidential – Internal/Restricted/Highly Restricted 4
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
What you can use depends on what you are backing up
• Size – A tiny table or a Massive Database
• Activity – Is the Database very busy or it is an inactive database
– Try not to overlap busy database with backups if possible
– For logical you ‘’l get locking collisions
– For physical the backup will be larger • It collects data to make everything consistent – this takes space
• Recovery will take longer – it must apply the data to make consistent.
• Cost – Is the data within the database compressed?
– Most databases are highly compressible – however if your database contains compressed cell data – don’t recompression won’t help and will slow things down
Oracle Confidential – Internal/Restricted/Highly Restricted 5
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Recovery
• How fast do you need to recover?
• Immediate
– Replication
• ASAP – Physical is several orders of magnitude faster
• Doesn’t matter (its Archival) – Then cost and size more of a factor
• Doesn’t matter (its Logical)
– Will be slower but flexibility is more important
Oracle Confidential – Internal/Restricted/Highly Restricted 6
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Cost/Benefit
Do the math
• Is it archived?
– Writing to a media manager or tape
– Writing to Cloud Storage
• Long term disk or other media cost
– Compression can save you $s
Oracle Confidential – Internal/Restricted/Highly Restricted 7
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
• Logical – New mysqlpump (included in 5.7)
• A modern highly parallel data pump
– Mysqldump
– Mysqldbexport/import • Part of MySQL Utilities
• Physical
• MySQL Enterprise Backup (MEB)
• Transportable Table Spaces
• OS Backups – “Cold” File System Backups
– Snapshots • For example LVM, other Filesystems or HW
based
• Continuous – Replicas (MySQL Replication)
• Often with slave lag
– Binlog Tools
Oracle Confidential – Internal/Restricted/Highly Restricted 8
One size does Not fit all “Use Cases” Pick the right tool(s) for the job(s)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Logical Backups
• Backup – Creates collection of SQL Statements used to recreate database objects (tables etc)
and the data within them – Inserts statements
– May include data in separate files saved in a cross platform format
• Restore – Runs these SQL Statements to restore objects and the data
Oracle Confidential – Internal/Restricted/Highly Restricted 9
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
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.
– Cross Platform –works no matter the platform
– Readability - Good assurance that database files are not corrupt - all the data is read and it is read using standard SQL queries.
Oracle Confidential – Internal/Restricted/Highly Restricted 10
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Logical Backup
• Disadvantages – Not an online solution – write operations are locked while performing the backup,
thereby blocking use of the database
– Poor to VERY Poor performance – backup and especially restore times are very slow for larger databases( 1or more orders of magnitude)
– Large Files – will be many times larger than actually database files
– Not consistent unless you lock everything the 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
Oracle Confidential – Internal/Restricted/Highly Restricted 11
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
• HOT, NON-Blocking for Innodb
• Performance –faster for backups and faster for restore
• Scalable – performance is near linear for larger databases.
• Efficient –processed mostly run outside server
• More compact backup files – up to 90% compression in some cases
• Secure – supports AES 256 compression
• Flexible – support for incremental backups,
partial backups, backup compression, point in time recovery and more.
• Many target supported directly
– Media Managers –Oracle Secure Backup
– Cloud Storage – AES S3, OpenStack Swift
– General Streaming (pipe to SSH etc)
• Archival Backups – suitable archival format for historical purposes
• Consistent – delivers consistent point in time recovery
Oracle Confidential – Internal/Restricted/Highly Restricted 12
Physical Backup (MEB)
• Copy of the internal files that constitute the MySQL database
• Restore Copy back Internal Files and Replay data changes to make data consistent.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
• FULL Logical Backups
– Impractical in many situations
• Logical RESTORE takes much longer – Typically 2x of BACKUP time
Oracle Confidential – Internal/Restricted/Highly Restricted 13
Performance with MySQL Enterprise Backup
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Transportable Tablespace (MEB)
• Copy and Move a MySQL Innodb Tablespace
• Advantages
– Fast • Runs at file level
• Flexible
– Can move one or more tablespaces
– Instance remains up when “restoring” a tablespace
Oracle Confidential – Internal/Restricted/Highly Restricted 14
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
To consider performance think of structure of a running backup – one way is like this
Oracle Confidential – Internal/Restricted/Highly Restricted 15
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
To consider performance think of structure of a running backup – or like this
Oracle Confidential – Internal/Restricted/Highly Restricted 16
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
To consider performance think of structure of a running backup – or like this
Oracle Confidential – Internal/Restricted/Highly Restricted 17
MEB 4.0 now reports back with Tape ID
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
To consider performance think of structure of a running backup – or like this
Oracle Confidential – Internal/Restricted/Highly Restricted 18
Cloud Storage
(S3, Swift))
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Oracle Secure Backup (OSB)
• Centralized Tape Backup Management
Oracle Confidential – Internal/Restricted/Highly Restricted 19
• RMAN- Oracle Recovery Manager, MEB – MySQL Enterprise Backup, SBT – Oracle’s API for Integration with Media Managers
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
What determines backup speed? The longest time
Oracle Confidential – Internal/Restricted/Highly Restricted 20
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
What determines backup speed? The longest time
Oracle Confidential – Internal/Restricted/Highly Restricted 21
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
What determines backup speed? The longest time
Oracle Confidential – Internal/Restricted/Highly Restricted 22
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
What determines backup speed? The longest Time
Oracle Confidential – Internal/Restricted/Highly Restricted 23
Unlikely on modern systems
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Too much Sharing – slows things down – Mostly IO Contention, At times CPU
Oracle Confidential – Internal/Restricted/Highly Restricted 24
RISKY Lose database and database
backup if storage system fails And SLOW
And has Side Effects
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Improving backup speed
Oracle Confidential – Internal/Restricted/Highly Restricted 25
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Does Highest Compression=Higher Speed Not typically
Oracle Confidential – Internal/Restricted/Highly Restricted 26
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
MySQL Enterprise Backup is Truly Parallel Read, Write, Processing
Oracle Confidential – Internal/Restricted/Highly Restricted 27
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Selective backup with TTS
• What is TTS, why better (in some cases) than normal partial backup
Oracle Confidential – Internal/Restricted/Highly Restricted 28
• MySQL 5.6+ feature: Transportable
• Table spaces
– Online table portability: Import/Export
• In MySQL 5.7 supports TTS per partition
• MEB implements methods that
– Limited Locking time
– Easy of use
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Image or Directory backup and Performance
• MySQL Enterprise Backup supports – Backup to a single image – a single file or streamed
– Backup to a directory
• In our testing confirms – Image is often a bit better
– Performance advantage comes from combining different steps that you might otherwise have to perform in sequence
• Going forward - Focus on image (a file) – Only supported for encryption, Cloud Storage, Media Managers..
– Image is simpler to manage
Oracle Confidential – Internal/Restricted/Highly Restricted 30
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
• Full Instance – Config/Settings
• Selective – Leverages TTS
– Great for large tables
• Encryption
– AES – required for sensitive data
• Skip Unused Pages – Reduces space
• Continuous progress – % Bytes, Status
• Monitor disk space
– Optional actions • Warn & Retry, Abort, Remove
Oracle Confidential – Internal/Restricted/Highly Restricted 31
Other features MEB provides
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Understanding your system
• CPU load – Patterns – look at times of day
– Load level – is it low or high – often DBs are low = 30%
• IO load
– Patterns – look at times of day
– Architecture
• IO rate – How fast can you read database files?
– How fast can you write?
– Run DD or other tools – whats you MB/sec?
Oracle Confidential – Internal/Restricted/Highly Restricted 32
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Backup Strategy
• A comprehensive plan for backup and recovery
Oracle Confidential – Internal/Restricted/Highly Restricted 34
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Validate
• No backup strategy is complete without validating backup
Oracle Confidential – Internal/Restricted/Highly Restricted 35
Copyright © 2014, 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-enterprisebackup/3.10/en/index.html
• How Do I get it
– https://edelivery.oracle.com
• Support and patches (My Oracle Support = MOS)
– https://support.oracle.com
Oracle Confidential – Internal/Restricted/Highly Restricted 36
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Thanks for Attending
• You‟ll get the slides
• Please don‟t hesitate to send us ideas, feedback, doc requests, blog requests, etc.
• http://bugs.mysql.com/report.php
• Directly through support
• Blog Comments
Oracle Confidential – Internal/Restricted/Highly Restricted 37
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 38