問題:備份和冗餘有什麼區別?mysql
備份是什麼?sql
databases Binlog my.cnf /data/xxx(數據目錄)數據庫
備份數據庫,還有日誌文件,還有配置文件,儘量將數據目錄裏面的文件所有備份。多線程
備份過程當中必須考慮因素:工具
邏輯備份就是在不停業務的狀況下進行備份。測試
備份的是建表、建庫、插入等操做所執行SQL語句(DDL DML DCL),適用於中小型數據庫,效率相對較低。this
(通常在數據庫正常提供服務的前提下進行的);如:mysqldump、mydumper、 into outfile(表的導出導入)等spa
直接複製數據庫文件,適用於大型數據庫環境,不受存儲引擎的限制,但不能恢復到不一樣的MySQL版本。.net
(通常在數據庫完全關閉或者不能完成正常提供服務的前提下進行的備份);如:tar、cp、xtrabackup、lvm snapshot等線程
在線熱備:AB複製(在線實時)(指的是對數據的冗餘)
M-S
M-Sn
M-S1-S2
M-M-Sn
Xtrabackup是一個對InnoDB作數據備份的工具,支持在線熱備份(備份時不影響數據讀寫),是商業備份工具InnoDB Hotbackup的一個很好的替代品
Xtrabackup有兩個主要的工具:xtrabackup、innobackupex
mydumper 多線程備份工具
https://launchpad.net/mydumper/mydumper-0.9.1.tar.gz 2015-11-06(最後更新時間)
• Sunday
An incremental level 0 backup backs up all blocks that have ever been in use in this database.
• Monday through Saturday
On each day from Monday through Saturday, a differential incremental level 1 backup backs up all blocks that have changed since the most recent incremental backup at level 1 or 0. The Monday backup copies blocks changed since Sunday level 0 backup, the Tuesday backup copies blocks changed since the Monday level 1 backup, and so forth.
• Sunday
An incremental level 0 backup backs up all blocks that have ever been in use in this database.
• Monday - Saturday
A cumulative incremental level 1 backup copies all blocks changed since the most recent level 0 backup. Because the most recent level 0 backup was created on Sunday, the level 1 backup on each day Monday through Saturday backs up all blocks changed since the Sunday backup.
須要掌握的備份方法:
邏輯數據的導入導出(into outfile)、mysqldump、mysqlhotcopy、xtrabackup和innobackupex
lvm-snapshot、mysqlbackup