Mysql

Percona 的 xtrabackup –apply-log 失敗並顯示“所有日誌文件必須同時創建”

  • September 15, 2014

我試圖弄清楚為什麼在我的 xtrabackup 文件上應用日誌不起作用。

我創建了一個執行 MySQL 5.5.24 的 VM。然後我創建了 sakila 測試數據庫並使用以下命令對其進行備份:

innobackupex --user=bckuser --password=XXXX --no-timestamp --compress /var/lib/mysql/dumps/backup/;

這成功地完成了。之後我想用這個命令應用日誌:

innobackupex --user=bckuser --password=XXXX --apply-log /var/lib/mysql/dumps/backup/;  

但我收到以下錯誤:

140912 21:46:19  innobackupex: Starting ibbackup with command: xtrabackup_55  --defaults-file="/var/lib/mysql/dumps/backup/backup-my.cnf"  --defaults-group="mysqld" --prepare --target-dir=/var/lib/mysql/dumps/backup --tmpdir=/tmp

xtrabackup_55 version 2.1.9 for Percona Server 5.5.35 Linux (x86_64) (revision id: 746)
xtrabackup: cd to /var/lib/mysql/dumps/backup
xtrabackup: This target seems to be not prepared yet.
xtrabackup: xtrabackup_logfile detected: size=2097152, start_lsn=(8564748)
xtrabackup: using the following InnoDB configuration for recovery:
xtrabackup:   innodb_data_home_dir = ./
xtrabackup:   innodb_data_file_path = ibdata1:10M:autoextend
xtrabackup:   innodb_log_group_home_dir = ./
xtrabackup:   innodb_log_files_in_group = 1
xtrabackup:   innodb_log_file_size = 2097152
xtrabackup: using the following InnoDB configuration for recovery:
xtrabackup:   innodb_data_home_dir = ./
xtrabackup:   innodb_data_file_path = ibdata1:10M:autoextend
xtrabackup:   innodb_log_group_home_dir = ./
xtrabackup:   innodb_log_files_in_group = 1
xtrabackup:   innodb_log_file_size = 2097152
xtrabackup: Starting InnoDB instance for recovery.
xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
140912 21:46:19 InnoDB: The InnoDB memory heap is disabled
140912 21:46:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140912 21:46:19 InnoDB: Compressed tables use zlib 1.2.3
140912 21:46:19 InnoDB: Initializing buffer pool, size = 100.0M
140912 21:46:19 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
140912 21:46:19  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
140912 21:46:20 InnoDB: Error: all log files must be created at the same time.
140912 21:46:20 InnoDB: All log files must be created also in database creation.
140912 21:46:20 InnoDB: If you want bigger or smaller log files, shut down the
140912 21:46:20 InnoDB: database and make sure there were no errors in shutdown.
140912 21:46:20 InnoDB: Then delete the existing log files. Edit the .cnf file
140912 21:46:20 InnoDB: and start the database again.
xtrabackup: innodb_init(): Error occured.
innobackupex: Error:
innobackupex: ibbackup failed at /usr/bin/innobackupex line 2560.

我用Google搜尋了很多,但我無法找出問題所在。你們有什麼想法嗎?

檢查日誌,上面有一點錯誤:

InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!

它正在嘗試創建新的 innodb 文件,因為找不到它們。

您需要在應用日誌之前解壓縮文件

innobackupex --decompress /...

然後,應用日誌。

順便說一句,完成第一個備份過程後,您無需指定使用者和密碼。

引用自:https://dba.stackexchange.com/questions/76584