Book Image

MariaDB High Performance

By : Pierre Mavro
Book Image

MariaDB High Performance

By: Pierre Mavro

Overview of this book

Table of Contents (18 chapters)
MariaDB High Performance
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

LVM


Logical volume manager (LVM) allows you to create a quick snapshot that can be used for backups. Apart from that, you can perform migration with easy rollback. This is a little bit out of the scope of this chapter, but as it is quick and could be very useful, we'll discuss it.

LVM is not a MariaDB tool, but a device mapper solution providing snapshot solutions. If you're using advanced filesystems such as ZFS or BTRFS, you can also use the snapshot feature to create backups.

Snapshot

To make a usable MariaDB datadir snapshot, you first need to lock your tables:

MariaDB [(none)]> flush tables with read lock;

Now we're sure there will be no changes on our instance. Let's create the snapshot on the system:

> lvcreate --snapshot -n snap_mariadb -L 2G /dev/data/mariadb

Here is a list of used commands:

  • --snapshot: This indicates we want to create an LVM snapshot

  • -n: This is the name of the snapshot

  • -L: This is the size of the snapshot

  • /dev/data/mariadb: This is the logical volume path

Now...