Linux-6.5 MariaDB-10 The backup data based on LVM snapshot

Source: Internet
Author: User

Understanding section:

LVM is a logical diskVolume Management(Logical Volume Manager), which is the Linux environment forDisk PartitioningA mechanism for management, LVM is a logical layer built on hard disks and partitions to improve the flexibility of disk partition management. LVM can be used to expand, snapshot, mirror and stripe on-line partitions, which is very powerful. The topic of this article is one of the features--snapshots.

A snapshot (Snapshot) is a fully available copy of a specified data collection that includes an image of the corresponding data at a point in time (the point at which the copy began). A snapshot can be a copy of the data it represents, or it can be a replica of the data;

In fact, the snapshot is equivalent to a picture, according to a certain moment should be the LV data. If, after the snapshot, the LV data changes, the snapshot copies the changed data into snap so that when you access the LV through a snapshot, the data is still the original data. Of course, when you create a snap, you definitely specify a size for the snapshot, and if the amount of data changed exceeds the specified size, then the snapshot will be corrupted.

configuration section:first, prepare the environment of LVM beforehand.1. See if LVM is created (mount):

650) this.width=650; "Width=" 949 "height=" 228 "title=" 1.png "style=" WIDTH:721PX;HEIGHT:226PX; "alt=" Wkiom1nrisotwy9maakcusdyfb8073.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKiom1NriSOTwY9MAAKcUSdyFb8073.jpg "/>

2, the current LVS, VGS use information:

650) this.width=650; "Width=" 951 "height=" 249 "title=" 2.png "style=" width:719px;height:198px; "alt=" Wkiom1nristrwpszaajc7djvhyc741.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/90/wKiom1NriSTRwpSzAAJC7DJvhyc741.jpg "/>

Second, request Kang and binary log.

1. Import the test environment library:

650) this.width=650; "width=" 950 "height=" "title=" 4.png "style=" width:720px;height:132px; "alt=" wkiol1ns5bfhj_ Rmaafmp3imldy988.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/CC/wKioL1Ns5bfhj_RMAAFMP3IMlDY988.jpg "/>

2. Request Global lock and scroll log:650) this.width=650; "Width=" 949 "height=" 274 "title=" 5.png "style=" Width:721px;height:256px;float:none; "alt=" Wkiom1nrisbd_dflaailetzsloo015.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/90/wKiom1NriSbD_dflAAILETzSlOo015.jpg "/>3. View the status of the scroll log:650) this.width=650; "Width=" 954 "height=" 134 "title=" 6.png "style=" Width:721px;height:141px;float:none; "alt=" Wkiol1nripyh5ynbaafilqgpnly028.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/90/wKioL1NriPyh5yNBAAFIlQGpnLY028.jpg "/>
third, do a good job of marking the binary log. 1. Create a directory for backup
650) this.width=650; "Width=" 949 "height=" "title=" 7.png "style=" Width:721px;height:45px;float:none; "alt=" Wkiol1nripzgbibvaacnqw9hprw804.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKioL1NriPzgBiBvAACnqW9hprw804.jpg "/>
2, do binary log file and location tag (manual);650) this.width=650; "Width=" 948 "height=" 135 "title=" 8.png "style=" WIDTH:720PX;HEIGHT:139PX; "alt=" Wkiom1ns5hhjn279aagtwdkvy8m002.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/CB/wKiom1Ns5hHjN279AAGTwDKVy8M002.jpg "/>iv. Create an LVM snapshot and release the global lock.1. Create a snapshot volume650) this.width=650; "width=" 955 "height=" "title=" 9.png "style=" Width:723px;height:72px;float:none; "alt=" Wkiol1nrip3byaclaad_tabxh94902.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/90/wKioL1NriP3ByacLAAD_taBXh94902.jpg "/>
2. Release the global lock650) this.width=650; "Width=" 949 "height=" "title=" 10.png "style=" Width:722px;height:81px;float:none; "alt=" Wkiom1nrisetrukoaacoty9sfy8388.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKiom1NriSeTRUKOAACOty9Sfy8388.jpg "/>
v. Backup data and delete snapshots.1. Mount the snapshot volume and see if the mount is successful:650) this.width=650; "width=" 950 "height=" 155 "title=" 11.png "style=" Width:724px;height:170px;float:none; "alt=" Wkiol1nrip7xi36-aah04pr4ayw428.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/90/wKioL1NriP7xi36-AAH04PR4AYw428.jpg "/>
2. Insert data into the backup table to test: View the table and the data in the table:650) this.width=650; "width=" 950 "height=" 284 "title=" 12.png "style=" Width:722px;height:263px;float:none; "alt=" Wkiom1nrisnaysywaajnj2s9eu8389.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/90/wKiom1NriSnAYsywAAJNJ2s9eU8389.jpg "/>
3, view the table and the data in the table:650) this.width=650; "Width=" 960 "height=" 441 "title=" 13.png "style=" Width:723px;height:370px;float:none; "alt=" Wkiol1nrip-dat-eaaf3elzukpe777.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKioL1NriP-DaT-eAAF3eLZuKPE777.jpg "/>
4. Back up the HELLODB and test directories in the/mnt/mydata/directory:650) this.width=650; "Width=" 952 "height=" 119 "title=" 14.png "style=" Width:719px;height:119px;float:none; "alt=" Wkiom1nrisrhxvpuaaf2j_sax4k829.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/90/wKiom1NriSrhXVPUAAF2J_SAx4k829.jpg "/>
5. After the backup is complete, unmount and delete the snapshot volume:650) this.width=650; "Width=" 951 "height=" "title=" 15.png "style=" Width:721px;height:105px;float:none; "alt=" Wkiom1nrisrwdbmvaad5eqprxmw669.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKiom1NriSrwDBMVAAD5EQpRXmw669.jpg "/>VI. Loss of analog data.1, accidentally stopped the MySQL service:650) this.width=650; "Width=" 948 "height=" title= "16.png" style= "Width:720px;height:61px;float:none;" alt= " Wkiol1nriqdrvmk8aacm27bjwpg163.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/90/wKioL1NriQDRVMK8AACm27bjWPg163.jpg "/>
2, accidentally will/data/mydata/directory (HELLODB and test)DeleteThe data:650) this.width=650; "Width=" 948 "height=" 154 "title=" 17.png "style=" Width:719px;height:150px;float:none; "alt=" Wkiom1nrisugtzulaaj5asnkrqw887.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKiom1NriSugTzuLAAJ5ASNkRqw887.jpg "/>Seven, simulated recovery data. 1. Restore the previously backed up data : 650) this.width=650; "Width=" 952 "height=" 154 "title=" 18.png "style=" Width:718px;height:156px;float:none; "alt=" Wkiol1nriqghms1paaic_d4g9rk307.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/90/wKioL1NriQGhms1PAAIC_D4g9Rk307.jpg "/>
2. Start the MySQL service:650) this.width=650; "Width=" 947 "height=" "title=" 19.png "style=" Width:721px;height:69px;float:none; "alt=" Wkiom1nriszw-9ogaabfj2fggdi661.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/90/wKiom1NriSzw-9ogAABfj2fGgdI661.jpg "/>
3. Connect to MySQL to view table data:650) this.width=650; "Width=" 952 "height=" 157 "title=" 20.png "style=" Width:721px;height:144px;float:none; "alt=" Wkiol1nriqhrqodqaaczpkwy92e682.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKioL1NriQHRQodQAACzPkwY92E682.jpg "/>
4. View/backups/binlog.pos file:650) this.width=650; "width=" 950 "height=" 109 "title=" 21.png "style=" Width:723px;height:128px;float:none; "alt=" Wkiom1nrisygcrgsaaeyjlz2fm8757.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/90/wKiom1NriSygCRgsAAEYJlz2Fm8757.jpg "/>5. Execute mysqlbinlog command to view:650) this.width=650; "Width=" 953 "height=" 295 "title=" 22.png "style=" Width:719px;height:281px;float:none; "alt=" Wkiol1nriqpif_miaajupxuehik599.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/91/wKioL1NriQPif_MIAAJUPXUEhIk599.jpg "/>
6. Import it into MySQL:650) this.width=650; "Width=" 947 "height=" "title=" 23.png "style=" Width:728px;height:44px;float:none; "alt=" Wkiol1nriqoru707aab4fugut4m335.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/91/wKioL1NriQORu707AAB4FUgUt4M335.jpg "/>
7. Finally, connect to MySQL and see if it recovers:650) this.width=650; "Width=" 951 "height=" 158 "title=" 24.png "style=" Width:720px;height:160px;float:none; "alt=" Wkiom1nris-ctm5kaacv6yaeeu8195.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/90/wKiom1NriS-CTm5kAACV6yAEeu8195.jpg "/>8. Finally give a suggestion:650) this.width=650; "Width=" 952 "height=" "title=" 25.png "style=" Width:721px;height:80px;float:none; "alt=" Wkiom1ns5bmgtzdpaacov78nh6i032.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/CB/wKiom1Ns5bmgtZDpAACoV78nH6I032.jpg "/>


Welcome to the Xiaomazi blog!!

.

This article is from the "ghost-fearing little girl" blog, please be sure to keep this source http://xiaomazi.blog.51cto.com/5891742/1413048

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.