Full backup + Incremental backup completes instant point restore

Source: Internet
Author: User

Full backup + Incremental backup completes time-to-point restore

First, some gratitude.


Backup type:

Hot backup, warm backup, cold backup

Hot backup, read/write not affected;

Warm backup: Only read operation can be performed;

Cold backup: Offline backup, read, write operations are terminated;

Physical and logical backups

Physical Backup: Copying data files

Logical backup: Exports data to a text file.

Full backups, incremental and differential backups:

Full backup: Back up all data

Incremental backup: Backs up only data that has changed since the last full backup or incremental backup;

Differential backup: Backs up only data that has changed since the last full backup;



Backup strategy: Weekly full + daily increment


Full backup; mysqldump

Incremental backup; Backing up binary log files (flush logs)

Begin:

First Tianquan Backup

1. Mysqldump-uroot-p--master-data=2--flush-logs---all-databases--lock-all-talbe >/root/alldatabases.sql


2.LESS alldatabase.sql; (view backup content)


You can also:

Compress backup: Mysqldump-hhostname-uusername-ppassword databasename | gzip > backupfile.sql.gz

Restore compressed MySQL database: Gunzip < backupfile.sql.gz | Mysql-uusername-ppassword DatabaseName





3.PURGE binary LOGS to ' mysql=bin.000011 '; Delete all binary logs before bin.00011;

(Copy a log before deleting this point in time)


Show binary logs; see what binary logs are in;


Some changes in the period data, the database is manipulated


4. Make an incremental log the next day:


Mysql>flush logs; Flush after mysql-bin.0000011 for the past day operation log;


#cd/mydata/data/

#cp mysql-bin.0000011/root/and then back up

#cp mysql-bin.0000012/root/

Or


#mysqlbinlog mysql-bin.000011 >/root/zhouyizengliang.sql {restore requires. sql file}


The third day of Tuesday data is inserted


Midway data hangs up with instant point restore :

Start, initialize the database first

cd/usr/local/mysql/

scripts/mysql_install_db--user=mysql--datadir=/mydata/data

Service mysqld Start


Order of Restore after startup:


1. Restore the full-Library backup first # Mysql-uroot-p < Alldatabases.sql

Re-import Incremental backup # MySQL </root/zhouyizengliang.sql


2. Back up the #mysql-bin.0000012 that were rolled up into a SQL file

#mysqlbinlog mysql-bin.000012-uroot-p > Temp.sql


3. Import the state of the restore to the latest moment

Mysql-uroot-p < Temp.sql


2 and 3 can be replaced with mysqlbinlog mysql-bin.000012 | mysql-uroot-p ;


This article is from the "Technical Achievement Dream" blog, please be sure to keep this source http://2367685.blog.51cto.com/2357685/1639421

Full backup + Incremental backup completes instant point restore

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.