Download presentation
Presentation is loading. Please wait.
Published byChester Barton Modified over 8 years ago
1
1 Build Your Own MySQL Time Machine Chuck Bell, PhD Mats Kindahl, PhD Replication and Backup Team Sun Microsystems 1
2
2 About the Speakers Chuck Bell, PhD > Working on Backup > (recovering) Windows Developer > charles.bell@sun.com Mats Kindahl, PhD > Replication Expert and Lead Developer > mats.kindahl@sun.com
3
3 Topics Point-in-time Recovery What is the MySQL Time Machine? Problem Statement Technology How do you use it? Demonstration A look under the hood Resources
4
Point-in-time recovery Backup image + Binlog files = Recovery image Saved recovery images can be archived Active recovery image is still growing Backup 2009-04-10 12:00:00 2009-04-11 12:00:00 Saved recovery image Active recovery image RI-1 RI-2
5
Backing up Take the backup Backup 2009-04-10 12:00:00 2009-04-11 12:00:00 Active recovery image RI-1 RI-2
6
Backing up Note binlog position for backup image Backup 2009-04-10 12:00:00 2009-04-11 12:00:00 Active recovery image RI-1 RI-2
7
Backing up Save away old backup image Backup 2009-04-10 12:00:00 2009-04-11 12:00:00 Active recovery image RI-1 RI-2
8
Backing up Save away binlog positions for old image Backup 2009-04-10 12:00:00 2009-04-11 12:00:00 Active recovery image RI-1 RI-2
9
Backing up Save away (or keep track of) binlog files Backup 2009-04-10 12:00:00 2009-04-11 12:00:00 Active recovery image RI-1 RI-2
10
Backing up This is now your old recovery image Backup 2009-04-10 12:00:00 2009-04-11 12:00:00 Active recovery image RI-1 RI-2 Saved
11
Backing up This is now your new active recovery image Backup 2009-04-10 12:00:00 2009-04-11 12:00:00 Active recovery image RI-1 RI-2 Saved Backup Active recovery image
12
Recovery Backup 2009-04-10 12:00:00 2009-04-11 12:00:00 Saved recovery image RI-1 RI-2 Backup Active recovery image Date
13
Recovery Backup 2009-04-10 12:00:00 2009-04-11 12:00:00 Saved recovery image RI-1 RI-2 Backup Active recovery image Date <End Start< Don't forget to stop slave!
14
Recovery Backup 2009-04-10 12:00:00 RI-1 RI-2 Date <End Start<
15
Recovery Backup 2009-04-10 12:00:00 RI-1 RI-2 Date <End Start< Play
16
Recovery Backup 2009-04-10 12:00:00 RI-1 RI-2 Date <End Start< Play Don't forget to do the same on the slave!
17
Recovery Backup 2009-04-10 12:00:00 RI-1 RI-2 Date <End Start< Play Now, do the same thing with the slave and ensure that they are in sync!
18
Recovery Backup 2009-04-10 12:00:00 RI-1 RI-2 Date <End Start< Play Remember that you go back in time, but binlog still grows! “Old“ events go here!
19
19 There must be a better way.... The MySQL Time Machine!
20
20 What is the MySQL Time Machine? Web-based utility for managing remote backup and restore. Key Features > Automated backup > Backup multiple databases > Restore by backup point – the point in time when a backup is run on the time machine > Restore by date – arbitrary datetime > Easy to use
21
21 Problem Statement Why can't someone build a fully automated backup solution that you can just turn on and forget? Automated backup and restore Simplified interface No knowledge of replication needed No complex installation** or configuration Does not require dedicated, expensive hardware
22
22 Technology Built using MySQL 6.0 PHP Perl Apache Replication MySQL Backup – new in 6.0! Time Machine runs on Linux > Currently connects to Windows or Linux systems
23
23 Architecture The time machine uses at most three connections to the database server you want to backup. > MySQL replication > MySQL client > SSH/SCP +--------+ +---------+ +---------+ | MySQL |--- replication ---> | MySQL | | Client | | Server | | Time | +----------+ | Web | | |<------------+ | Machine | | Apache | | Browser | | | | | | | PHP | | | | |<------+ | | | | | | | +--------+ | | +---------+ +----------+ +---------+ | | | | +---------+ | +------>| MySQL | | | Client | | | | | +---------+ | | +---------+ +------------>| SSH/SCP | | shell | | | +---------+
24
24 How Replication is Used Master/Slave Row-based Binary Logging Point-in-time Recovery
25
25 How Do You Use the Time Machine? Administrator's Console Setup and Configuration Connecting the Time Machine Performing a Restore by Backup Point Performing a Restore by Date Administration Functions
26
26 Administrator's Console Main Screen Initiate Restores Monitor Status
27
27 Status DB - The database server to which the time machine is connected. TM - The MySQL instance on the time machine. Tx - Connection status to the time machine's MySQL instance. Rx - Status of communication (replication) from the database server.
28
28 Setup and Configuration Connect Control Time Machine Disconnect and reconnect Set automated backup frequency
29
29 Connecting the Time Machine Results page Shows each step Displays data for diagnostics
30
30 Examining Backup Points Detailed Report Summary Report Can be helpful to see what is included in each backup point
31
31 Performing Restore by Backup Point Select backup point Click Restore to Backup Point Automated How cool is that?
32
32 Restore Results
33
33 Performing Restore by Date Select datetime Click Restore to Datetime Automated How cool is that?
34
34 Restore Results
35
35 Maintenance Operations Connect Disconnect and Reconnect Save Configuration Start Stop Reset
36
36 Live Demonstration
37
37 A Look Under The Hood Connection Sequence Restore by Backup Point Restore by Date
38
38 Connection Sequence Stop replication Backup data on database server Record database server's binlog information Copy file to time machine Restore data on time machine Restart replication Sync slave with master on time machine Perform initial backup Launch automated backup cron job
39
39 Restore by Backup Point Stop replication Flush logs on time machine Copy file to database server Run restore on database server Record database server's binlog information Run restore on time machine Start replication
40
40 Restore by Date Determine nearest backup point and binary log on time machine Stop replication Flush logs on time machine Copy file to database server Run restore on database server Use mysqlbinlog to replay binary log on database server Record database server's binlog information Run restore on time machine Use mysqlbinlog to replay binary log on database server Start replication
41
41 Resources Books > Expert MySQL > Attribute Level Versioning http://www.apress.com/book/bookDisplay.html?bID=10200 http://dev.mysql.com/doc/refman/6.0/en/replication.html http://dev.mysql.com/doc/refman/6.0/en/backup-and-recovery.html http://dev.mysql.com/downloads http://forge.mysql.com/wiki/OnlineBackup http://dev.mysql.com/doc/refman/6.0/en/installing.html http://dev.mysql.com/backup
42
42 Related Conference Sessions The Future of Replication > 04/22/2009 11:55am - 12:40pm Room: Ballroom G Replication Tricks & Tips > 04/23/2009 10:50am - 11:50am Room: Ballroom F Backup and Replication Integration Techniques > 04/23/2009 2:00pm - 2:45pm Room: Ballroom F
43
43 Questions?
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.