Using the snapshot function of LVM to make the data almost hot prepared

Source: Internet
Author: User

LVM snapshot feature for almost hot-standby

The snapshot feature of LVM can log information from a moment to the snapshot area, so you can take advantage of this feature to make a full backup of the data. The newly submitted data can then be incrementally backed up and restored using a binary log file. Therefore, it is possible to make almost hot preparation of data in this way.

To use the snapshot capabilities of LVM for almost hot provisioning, the following conditions need to be met:

1. The data file must be on a logical volume

2. The volume group where this logical volume is located must have sufficient space to store the snapshot volume

3. Data files and transaction logs are to be on the same logical volume.

The implementation steps are as follows:

1. Open session, apply read lock, lock all tables, and perform log scrolling

Mysql> flush tables with read lock;

Mysql>flush logs;

2, by opening another terminal, save the binary log files and location and other related information

$mysql-uroot-p-e ' show Master Status\g ' >/path/to/master.info

3. Create a Snapshot volume

#lvcreate-L #-s-p R-n Lv_name/path/to/source_lv_name

4. Release the lock

Mysql>unlock tables;

5. Mount the snapshot volume and copy the data inside

#mount/path/to/lv_name/path/to/dir/

#cp-a/path/to/dir/*/path/to/otherdir/

6. Deleting a snapshot volume

#umount Lv_name

7. Incremental backup binary log files

8. When restoring using binary log files, turn off the binary logging feature

Mysql>set Global sql_log_bin=0;

This article is from the "Linux Learning path" blog, so be sure to keep this source http://xslwahaha.blog.51cto.com/4738972/1585054

Using the snapshot function of LVM to make the data almost hot prepared

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.