xtrabackup_logfile。FLUSH TABLES WITH READ LOCK) 拷貝非 InnoDB 文件(.frm、MyISAM 等)。恢復階段:--prepare 時對拷貝出的數據文件應用 Redo Log(前滾提交事務、回滾未提交事務),達到一致性狀態。建議執行兩次 --prepare,第二次生成新 Redo Log 加速實例啟動。
# 1. 啟動 xtrabackup 子進程
innobackupex: Starting ibbackup with command: xtrabackup_55 --backup --suspend-at-end --log-stream
# 2. 掛起等待,開始拷貝 InnoDB 文件
xtrabackup: suspend-at-end is enabled.
>> log scanned up to (2371741708)
innobackupex: Backing up as tar stream 'ibdata1'
innobackupex: Backing up file '/home/MySQL/3306/data/test/t.ibd'
# 3. 連接數據庫,鎖表拷貝非 InnoDB 文件
innobackupex: Starting to lock all tables...
innobackupex: All tables locked and flushed to disk
innobackupex: Backing up .frm, .MYD, .MYI, .TRG ... files
innobackupex: Finished backing up .frm ... files
# 4. 解鎖,複製剩餘 Redo Log 段
innobackupex: Resuming ibbackup
xtrabackup: Transaction log of lsn (2371741708) to (2371742526) was copied.
innobackupex: All tables unlocked
innobackupex: Backup created in directory '/home/MySQL/backup/data/3306'
innobackupex: MySQL binlog position: filename 'bin.000014', position 309836330
innobackupex: completed OK!
--incremental --incremental-lsn=LSN 基於上次備份 LSN 做增量。--stream=tar 直接輸出 tar 流,配合 ssh 或 nc 遠程備份,落地即備份。