Detailed description of Linux-6.5 backup data based on LVM snapshot in MariaDB-10

Source: Internet
Author: User
Understanding: LVM is short for logical disk volume Management (LogicalVolumeManager). It is a mechanism for managing disk partitions in Linux, LVM is a logical layer built on hard disks and partitions to improve the flexibility of disk partition management. LVM supports online resizing of partitions, snapshots, images, and striping, providing powerful functions. This article

Understanding: LVM is short for Logical Volume Manager. It is a mechanism for managing disk partitions in Linux, LVM is a logical layer built on hard disks and partitions to improve the flexibility of disk partition management. LVM supports online resizing of partitions, snapshots, images, and striping, providing powerful functions. This article

Understanding:

LVM is short for Logical Volume Manager. It is a mechanism for managing disk partitions in Linux, LVM is a logical layer built on hard disks and partitions to improve the flexibility of disk partition management. LVM supports online resizing of partitions, snapshots, images, and striping, providing powerful functions. The topic of this article is a feature-snapshot.

A Snapshot is a fully available copy of a specified data set. This copy includes an image of the corresponding data at a certain time point (the start time of the copy. A snapshot can be a copy of the data it represents or a copy of the data;

In fact, snapshots are equivalent to the lv data of a photo at a certain time point. If the lv data changes after the snapshot, the snapshot will copy the changed data to the snap, so that when you access the lv through the snapshot, the data is still the original data. Of course, when you create a snap, you must specify a size for the snapshot. If the changed data volume exceeds the specified size, the snapshot will be damaged.

The following are simple configuration steps:

1. Prepare the LVM environment in advance. 1. Check whether the LVM is created (whether it is mounted ):

2. Current lvs and vgs usage information:


Ii. Request unlocking and binary logs. 1. Import the database of the test environment:
2. Request a global lock and scroll the log. 3. view the status of the scroll log:


3. Mark binary logs. 1. Create a directory for backup

2. Mark binary log files and locations (manually );


Iv. Create LVM snapshots and release global locks. 1. Create snapshot volumes
2. Release the global lock


V. Back up data and delete snapshots. 1. Mount the snapshot volume and check whether the volume is mounted successfully:
2. Insert data into the backup table for testing: view the table and table data:
3. View table and table data:
4. The hellodb and test directories under the backup/mnt/mydata/directory:
5. After the backup is complete, Unmount and delete the snapshot volume:

6. Simulate data loss.
1. Accidentally stopped the MySQL service:
2. accidentally delete data in the/data/mydata/directory (hellodb and test:

VII. Simulate data recovery. 1. Restore the data backed up earlier:
2. Start the MySQL service:
3. Connect to MySQL to view table data:
4. view the/backups/binlog. pos file: 5. Run the mysqlbinlog command to view the file:
6. Import it to MySQL:
7. Connect to MySQL and check whether the database is restored. 8. The last suggestion is as follows:

OK !!!

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.