Mysql Incremental Backup

Source: Internet
Author: User

We can perform full backup every day for a small amount of mysql Incremental Backup databases, because this does not take much time, but when the database is very large, we are unlikely to perform a full backup every day, in addition, it is changed to a weekly full backup, and an incremental backup every day is similar to this backup policy. The principle of Incremental backup is to use mysql binary logs, so we must enable the binary log function. Www.2cto.com I. Incremental Backup 1. For example, we make a full backup at eleven o'clock P.M. on Sunday: mysqldump -- single-transaction -- flush-logs -- master-data = 2 -- all-databases> fullbackup_sunday_11_PM. SQL two rows are displayed in the SQL file: -Position to start replication or point-in-time recovery from-change master to MASTER_LOG_FILE = 'bin-log.000002 ', MASTER_LOG_POS = 107; the second line contains the information we need, the changes after the backup are saved to the bin-log.000002 binary. 2. Then we make an incremental backup at eleven o'clock P.M. on Monday: mysqladmin flush-logs will generate a new binary log file bin-log.000003, bin-log.000002 stores all the changes since eleven o'clock P.M. Sunday till now, and we just need to back up this file to a safe place. Then on Tuesday we made an incremental backup, or execute the same command, and then we saved the bin-log.000003 file. 2. Recover the backup. For example, if a fault occurs at noon on Wednesday, we need to first import the complete backup on Sunday: mysql <fullbackup_sunday_3_AM. SQL and then import the Incremental backup on Monday and Tuesday: mysqlbinlog bin-log.000002 bin-log.000003 | mysql at this time we have recovered all the backup data, we can also find the bin-log.000004 to further restore the latest data.

Related Article

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.