Introduction to Basic Concepts of Backup

Ⅰ. Backup type

Here are three full backups

hot backup

  • Online backup
  • Basically no impact on the application (application reading and writing will not block, but the performance will still decline, so try not to do backup on the master, do it on the slave library)

cold backup

  • Backup data files, requires downtime
  • Backup all files in the datadir directory

Is it ok to just copy this directory? The actual undo, redo, binlog can be configured in different directories, which may not be under datadir

Special case:

create table zz(a int) data directory = '/tmp/'

What should I do in this situation? Parse the data directory of each table during backup? So it is not recommended to use this thing to build a table

tips:

Put redo, undo, and binlog on hdd and data on ssd?

No need, ssd is very cheap now, and the sequence is not bad. It is good to make a raid with three or four disks. There is no need to separate them.

Having said that, there are not many opportunities for cold backup, and it is unacceptable to shut down

warm backup

  • For myisam backup (myisam does not support hot backup), the instance is read-only but not writable during backup
  • Great impact on applications
  • Usually add a read lock

Ⅱ. MySQL hot standby tool

ibbackup

  • Official Backup Tool
  • toll
  • physical backup

xtrabackup

  • Open source community backup tool
  • Open source is free, the free version of the above thing (there are problems with the old version, the data backed up may have problems)
  • physical backup 

mysqldump

  • The official self-contained backup tool is open source and free
  • Logical backup (slow)
  • don't block dml, block ddl

Ⅲ. Logical backup vs physical backup

- logic physics
Backup method Backup database logical content Backup database physical files
advantage The backup file is relatively small, only the data and structure in the table are backed up The recovery speed is relatively fast (the physical file recovery has basically completed the recovery)
shortcoming Slower recovery (requires index rebuilding, stored procedures, etc.) The backup file is relatively large (backup tablespace, including data and indexes, fragmentation)
business impact Buffer pool pollution (read all data once, read into bp), I/O load increases Increased I/O load
Representative tool mysqldump ibbackup xt xtrabackup

tips:

The backup method is generally considered from the following dimensions

  • Backup speed
  • recovery speed
  • Backup size
  • business impact

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325259440&siteId=291194637