-
Notifications
You must be signed in to change notification settings - Fork 14
/
mysqlBackup.md
37 lines (27 loc) · 1.34 KB
/
mysqlBackup.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# InnoDB Backup and Recovery
## InnoDB Backup
### Hot Backups
The **mysqlbackup** command, part of the MySQL Enterprise Backup component
### Cold Backups
1. Perform a [slow shutdown](https://dev.mysql.com/doc/refman/5.6/en/glossary.html#glos_slow_shutdown) of the MySQL server and make sure that it stops without errors.
1. Copy all `InnoDB` data files (`ibdata` files and `.ibd` files) into a safe place.
1. Copy all the `.frm` files for `InnoDB` tables to a safe place.
1. Copy all `InnoDB` log files (`ib_logfile` files) to a safe place.
1. Copy your `my.cnf` configuration file or files to a safe place.
### Logical Backups Using mysqldump
In addition to physical backups, it is recommended that you regularly create logical backups by dumping your tables using [mysqldump](https://dev.mysql.com/doc/refman/5.6/en/mysqldump.html).
### Tips
- `backup-mysql.sh`
- `mysql-backup.sh`
## InnoDB Recovery
### Point-in-Time Recovery
### Recovery from Data Corruption or Disk Failure
### InnoDB Crash Recovery
The InnoDB crash recovery process consists of several steps:
- Redo log application
- Roll back of incomplete transactions
- Change buffer merge
- Purge
## References
- [14.18 InnoDB Backup and Recovery](https://dev.mysql.com/doc/refman/5.6/en/innodb-backup-recovery.html)
- [CentOS 7 MySQL自动备份shell脚本](https://www.jianshu.com/p/746db5ceec02)