Experimental content
Time database. Table contents (ID) Action content
8-point db1.t1 for full backup
9 points db1.t1 4,5 (new additions) Add data
10 point db1.t1 Delete db1 Delete db1
11 o'clock the database contents are found to be incorrect, and the normal data is requested.
8-point Data full backup
Mysqldump-uroot-ppassword--all-databases--single-transaction--master-data=2 >/tmp/mysql.all.sql
Command parameter Description:
--all-databases =-A backs up all the libraries
--single-transaction can achieve consistent data and service availability
--flush-logs a new log is generated after a full backup, and then the operation records for the database are present in the new log file
--master-data=2 the file name of the log and the position number that starts in this log.
9 Point Data Increase
Instert into Db1.t1 (4), (5);
10-point Data deletion
Delete DB1
Stop Service
Clear Environment
Start-up service
Import full backup data
Mysql-uroot-ppassword </tmp/mysql.all.sql
Import incremental backup data (replay log)
A. Confirming information about log files and Master_log_pos
Sed-n ' 22p '/tmp/mysql.all.sql (mariadb5.5 fixed storage position)
B. Display results:
[Email protected] ~]# sed-n ' 22p '/tmp/mysql.all.sql
--Change MASTER to master_log_file= ' servera.000006 ', master_log_pos=245;
C. Replay Log
mysqlbinlog/var/lib/mysql-log/servera.000006--start-position=245--stop-position=672 |mysql
Test
This article from the "Small Shack" blog, declined reprint!
MARIADB using mysqldump binary database backup operations