您好,登錄后才能下訂單哦!
innobackupex
全備份原理:
1.執(zhí)行一次checkpoint,找到最后那個(gè)checkpoint的lsn
2.從這個(gè)lsn開始記錄所有產(chǎn)生的redo log
3.cp innodb data
4.flush tables with read lock
5.cp 非innodb 數(shù)據(jù)(myisam數(shù)據(jù),.FYM,FIM等文件)
6.鎖定binlog文件并且記錄當(dāng)前的binlog postion
7.釋放所有binlog 鎖 ,釋放unlock tables
增量備份的原理:在第三步的有所變化
3.數(shù)據(jù)頁(yè)面的比對(duì)(lsn),記錄下有l(wèi)sn不一樣的數(shù)據(jù)頁(yè)面
備份命令:
全備:
innobackupex --user=$user --password=$pass --socket=$sock_path --no-timestamp --parallel=$num $DIR$basedir/basebk
增量備份:
innobackupex --user=$user --password=$pass --socket=$sock_path --no-timestamp --parallel=$num --incremental-basedir=$dir_bak
--incremental $dir_incre
常用參數(shù):
--no-timestamp : 使用自定義目錄
--parallel=$num : 并行的線程數(shù)
--databases:指定需要備份db列表,還可以指定到表
--incremental-basedir:上一次備份目錄
innobackupex 恢復(fù)原理:將page head 部的lsn和 redo log 中l(wèi)sn進(jìn)行對(duì)比,
如果redo lsn 比頁(yè)面的page的head 中的lsn大 ,就恢復(fù)該頁(yè)面,
1.只有全備
innobackupex --apply-log /storage/group2/bak/basebk
2.有增量備份
innobackupex --apply-log --redo-only /storage/group2/bak/basebk
innobackupex --apply-log --incremental /storage/group2/bak/basebk --incremental-dir=/storage/group2/bak/incbk1
常用參數(shù):
--apply-log: 應(yīng)用全部的redo log
--redo-only:只應(yīng)用commit的redo的 log
--incremental:每次恢復(fù)的過程中都是全備
問題2:(確認(rèn))
在應(yīng)用最后一個(gè)增量備份的時(shí)候使用了 --redo-only 參數(shù),導(dǎo)致 mysql 啟動(dòng)失敗
,報(bào)錯(cuò):日志丟失或者文件損壞問題分析
解釋:在mysql啟動(dòng)時(shí)候會(huì)對(duì)mysql數(shù)據(jù)頁(yè)面數(shù)據(jù)的完整性進(jìn)行檢測(cè),發(fā)現(xiàn)有問題的頁(yè)面就試圖
恢復(fù),而恢復(fù)是要通過redolog的,當(dāng)redolog找不到的時(shí)候,就會(huì)報(bào)錯(cuò),頁(yè)面損壞。
問題3:(已經(jīng)確認(rèn))
在有增量備份的時(shí)候進(jìn)行恢復(fù),是否可以不要--redo-only 參數(shù)
不可以,可能會(huì)造成部分?jǐn)?shù)據(jù)數(shù)據(jù)丟失
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。