我试图弄清楚为什么在我的 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.
我用谷歌搜索了很多,但我无法找出问题所在。你们有什么想法吗?
检查日志,上面有一点错误:
它正在尝试创建新的 innodb 文件,因为找不到它们。
您需要在应用日志之前解压缩文件:
然后,应用日志。
顺便说一句,完成第一个备份过程后,您无需指定用户和密码。