MySQL backup: mylvmbackup introduction and use

Source: Internet
Author: User
Tags mysql backup
The required dependent Database Config: IniFilesMIME: LiteDBD: mysqlDBISys:

The required dependent Database Config: IniFilesMIME: LiteDBD: mysqlDBISys:

Required dependent Libraries
Config: IniFiles
MIME: Lite
DBD: mysql
DBI
Sys: Syslog
We recommend that you use CPAN for installation.

First, obtain the global read lock, write the data in the cache to the disk, then execute the LVM snapshot, and finally unlock. The following is a main process of my collection.

20131105 13:51:17 Info: Connecting to database...

20131105 13:51:17 Info: Flushing tables with read lock...

20131105 13:51:17 Info: Running: lvcreate-s -- size = 1G -- name = mysql_snapshot/dev/vg/mysql

20131105 13:51:18 Info: Unlocking tables...

20131105 13:51:18 Info: Disconnecting from database...

20131105 13:51:18 Info: Running: mount-o rw/dev/vg/mysql_snapshot/var/tmp/mylvmbackup/mnt/backup

20131105 13:51:18 Info: Copying/tmp/mylvmbackup-backup-20131105_135117_mysql-8aDBvc.pos to/var/tmp/mylvmbackup/mnt/backup-pos/backup-20131105_135117_mysql.pos...
20131105 13:51:18 Info: Copying/etc/my. cnf to/var/tmp/mylvmbackup/mnt/backup-pos/backup-20131105_135117_mysql_my.cnf...

20131105 13:51:18 Info: Taking actual backup...
20131105 13:51:18 Info: Creating tar archive/var/tmp/mylvmbackup/backup/backup-20131105_135117_mysql.tar.gz


20131105 13:53:34 Info: Running: umount/var/tmp/mylvmbackup/mnt/backup

20131105 13:53:34 Info: LVM Usage stats:
20131105 13:53:34 Info: lv vg Attr LSize Origin Snap % Move Log Copy % Convert
20131105 13:53:34 Info: mysql_snapshot vg swi-a-1.00G mysql 0.20

20131105 13:53:34 Info: Running: lvremove-f/dev/vg/mysql_snapshot

After the entire process is completed, only backup-20131105_133167_mysql.tar.gz is left. The tar package contains binary log coordinates, my. cnf, and all mysql files.

This tool also has the mail alarm function. The following is the mail alarm section of my configuration file.
# Cat/etc/mylvmbackup. conf | grep mail
Mail_report_on = always
Mail_from = root @ localhost
Mail_to = 645522734@qq.com
Mail_subject = mylvmbackup report for localhost
Note
-- Mail_report_on: Value: {never, always, errors}. never is the default value, always indicates that emails are always sent, and errors is only used when an error occurs.

For more information about mylvmbackup, click here.
Mylvmbackup: click here

Related reading:

MySQL backup: mylvmbackup introduction and use

Using mysqldump in Linux to back up a MySQL database as an SQL File

Use mysqldump in Linux to regularly back up MySQL Databases

,

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.