100% found this document useful (4 votes)
1K views

Performing MySQL Backups Using LVM Snapshots

This document discusses using LVM snapshots to perform MySQL backups. It provides an overview of LVM, describes how to take MySQL backups using LVM snapshots, and discusses tools like mylvmbackup that can help automate the backup process when using LVM snapshots.

Uploaded by

Oleksiy Kovyrin
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
1K views

Performing MySQL Backups Using LVM Snapshots

This document discusses using LVM snapshots to perform MySQL backups. It provides an overview of LVM, describes how to take MySQL backups using LVM snapshots, and discusses tools like mylvmbackup that can help automate the backup process when using LVM snapshots.

Uploaded by

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

Performing MySQL Backups

using LVM Snapshots

Presented by,
MySQL AB® & O’Reilly Media, Inc.
2008-04-16
MySQL Conference & Expo 2008
Santa Clara, CA, USA

Lenz Grimmer <[email protected]>


MySQL Community Relations Manager
Database Group, Sun Microsystems Inc.
Session content

 Introduction to LVM
Features, Benefits, Terminology, Tools
 LVM Snapshots
Overview, Features, Use case
 Backing up MySQL using Snapshots
Benefits, Procedure, Caveats
 mylvmbackup
 Practical hints & recommendations
 Related tools & technologies
Introduction to LVM
 Storage Virtualisation / Abstraction for
Linux
 Initially developed by Sistina (now
Red Hat)
 More flexible than partitioned disks:
Online adding/removing of volumes
Online resizing/moving of volumes
Grouping of volumes
 Beneficial for both large and small
storage systems
Terminology

 Logical Volume (LV)


 Logical Extent (LE)
 Volume Group (VG)
 Physical Volume (PV)
 Physical Extent (PE)
Overview
Tools

 Commandline
PVs: pvcreate, pvdisplay, pvmove, pvresize ...
VGs: vgcreate, vgdisplay, vgextend, vgreduce ...
LVs: lvcreate, lvdisplay, lvextend, lvreduce...
 YaST2 (openSUSE/SLES)
 Disk Setup & system-config-lvm
(Fedora/RHEL)
 IBM EVMS tools (GUI, CLI)
 LVM GUI (Java)
LVM Snapshots

 Atomic, instant & exact copy of


another LV
 Low disk space requirements (COW)
 LVM2 provides read & write access on
snapshots
useful for testing purposes (e.g. software updates)
or cloning Xen DomU instances
Benefits of MySQL snapshot backups

 “Almost hot” (no downtime)


 Supports all storage engines
 Fast, low overhead
 Easy integration
 Fast recovery
 Free

Picture taken by Travis Gray (flickr)


General procedure

 FLUSH TABLES
 FLUSH TABLES WITH READ LOCK
 Create the snapshot (lvcreate -s)
 (SHOW MASTER STATUS)
 UNLOCK TABLES
 Mount snapshot, perform backup
 Unmount and discard the snapshot
(lvremove)
Caveats / Gotchas

 InnoDB ignores FLUSH TABLES


WITH READ LOCK
 FLUSH TABLES performance impact
 I/O impact while snapshot is active
 Handling data spread on multiple
volumes (e.g. logs on separate LV,
DBs spread across multiple LVs)
mylvmbackup

 Perl script (GPL)


 Creates tar.gz archives or directory
copies (using rsync)
 Performs InnoDB log recovery on the
snapshot prior to backup (LVM2)
 http://www.lenzg.org/mylvmbackup/
General hints & recommendations

 File system recommendations


XFS, ReiserFS (support online resizing of Lvs)
 Snapshot size
Related tools & technologies

 ZFS snapshots/clones
 SAN snapshots
 ext3cow
 Time Machine (Mac OS X)
 Veritas Volume Manager (VxVM)
 Volume Shadow Service (VSS) for MS
Windows Server 2003
 SGI XVM / HP-UX LVM
Q&A

 Any questions/suggestions/ideas?

You might also like