0% found this document useful (0 votes)
812 views

Backup and Recovery Basics Presentation

This document discusses various backup and recovery methods and techniques for MySQL databases. It covers taking full backups, using the binary log to restore to a point in time, recording the binlog position during backups, and point-in-time recovery using the mysqlbinlog tool to replay binlog events. Homework assignments are given to have students practice creating backups, making changes, and restoring from backups. Advanced topics like large data backups, filtering, offsite recovery, and distributed data are also mentioned.

Uploaded by

yejr
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
812 views

Backup and Recovery Basics Presentation

This document discusses various backup and recovery methods and techniques for MySQL databases. It covers taking full backups, using the binary log to restore to a point in time, recording the binlog position during backups, and point-in-time recovery using the mysqlbinlog tool to replay binlog events. Homework assignments are given to have students practice creating backups, making changes, and restoring from backups. Advanced topics like large data backups, filtering, offsite recovery, and distributed data are also mentioned.

Uploaded by

yejr
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Backup & Recovery

Basics
Presented by,
MySQL & O’Reilly Media, Inc.
Kai Voigt, MySQL
Instructor
Time Machine
INSERT
UPDATE
Backup CREATE
UPDATE

Time
DROP
INSERT
ALTER
GRANT
Time

UPDATE
DROP TABLE
Time Machine
INSERT
UPDATE
Backup CREATE
UPDATE

Time
DROP
INSERT
ALTER
GRANT
Time

UPDATE
DROP TABLE
The Binary Logfile
[mysqld]
log-bin
expire-logs-days=3

-rw-rw---- 1 _mysql _mysql 125 Mar 4 13:58 localhost-bin.000001


-rw-rw---- 1 _mysql _mysql 166 Mar 4 14:05 localhost-bin.000002
-rw-rw---- 1 _mysql _mysql 2976388 Mar 6 15:27 localhost-bin.000003
-rw-rw---- 1 _mysql _mysql 724138 Mar 14 08:58 localhost-bin.000004
-rw-rw---- 1 _mysql _mysql 224 Mar 11 09:54 localhost-bin.index
mysqlbinlog
# mysqlbinlog kai-voigts-macbook-pro-bin.000004

#8314 17:39:44 server id 1 end_log_pos 724166 ! Intvar


SET INSERT_ID=4080/*!*/;
# at 724166
#8314 17:39:44 server id 1 end_log_pos 724276 ! Query!
thread_id=3
SET TIMESTAMP=1205512784/*!*/;
SET @@session.sql_mode=0/*!*/;
INSERT INTO City (Name) VALUES ("Santa Clara")/*!*/;
# at 724276
#8314 17:39:53 server id 1 end_log_pos 724364 ! Query!
thread_id=3
SET TIMESTAMP=1205512793/*!*/;
DELETE FROM City LIMIT 4/*!*/;
# at 724364
#8314 17:40:2 server id 1 end_log_pos 724467 ! Query!
thread_id=3
SET TIMESTAMP=1205512802/*!*/;
UPDATE City SET Population=Population*2/*!*/;
Time Machine
INSERT
UPDATE
Backup CREATE
UPDATE

Time
DROP
INSERT
ALTER
GRANT
Time

UPDATE
DROP TABLE
e
e

in
cy

atur

Eng
ten
Methods

ed

t
per

Cos
sis

Spe
rage
Tem
Con

Sto
Perfect Backup ! Hot All Fast Free

No Backup Hot All Fast Free

Catholic Backup Hot All Fast :-)

Copy DataDir ! Cold All Fast Free

Copy MyISAM Files ! Warm MyISAM Fast Free

Copy InnoDB Files ! Cold InnoDB Fast Free


e
e

in
cy

atur

Eng
ten
Methods

ed

t
per

Cos
sis

Spe
rage
Tem
Con

Sto
Perfect Backup ! Hot All Fast Free

InnoDB Hot Backup ! Hot InnoDB Slow $

mysqldump ! Warm All Slow Free

mysqldump --single-transaction ! Hot InnoDB Slow Free

Replication ! Hot All Fast Free

Filesystem Snapshot ! Hot All Fast Free


Time Machine
INSERT
UPDATE
Backup CREATE
UPDATE

Time
DROP
INSERT
ALTER
GRANT
Time

UPDATE
DROP TABLE
Record Binlog position
! mysqldump --master-data
! SHOW MASTER STATUS
! ls -l
! cat master.info
Time Machine
INSERT
UPDATE
Backup CREATE
UPDATE

Time
DROP
INSERT
ALTER
GRANT
Time

UPDATE
DROP TABLE
Point In Time Recovery
! mysqlbinlog
--start-position
--stop-position
Home Work
! Create a Full Backup
! Do useful Changes
! Do stupid Changes
! Go back in Time
The non-Basics
! Large Data
! Filtering
! Offsite Recovery
! Multiple Storage Engines
! Distributed Data

! MySQL 6.0 - Online Backup


Thank you!
! [email protected]
! http://dev.mysql.com/doc/refman/5.1/en/backup-
and-recovery.html

You might also like