使用 percona 优化的 .cnf 文件后,备份失败
安装 my.cnf
# service mysql stop
(Installed my.cnf)
# rm ib_logfile0
# rm ib_logfile1
# service mysql start
Mysql creates new log files on startup
我的.cnf
# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208
[client]
# CLIENT #
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld]
# GENERAL #
user = mysql
default_storage_engine = InnoDB
pid_file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
basedir = /usr/local/mysql
tmpdir = /tmp
# MyISAM #
key_buffer_size = 32M
myisam_recover = FORCE,BACKUP
# SAFETY #
max_allowed_packet = 16M
max_connect_errors = 1000000
skip_name_resolve
sql_mode = STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_ SUBSTITUTION
sysdate_is_now = 1
innodb = FORCE
innodb_strict_mode = 1
bind_address = 127.0.0.1
# DATA STORAGE #
datadir = /var/lib/mysql
# BINARY LOGGING #
log_bin = /var/lib/mysql/mysql-bin
expire_logs_days = 14
max_binlog_size = 100M
sync_binlog = 1
# CACHES AND LIMITS #
tmp_table_size = 32M
max_heap_table_size = 32M
query_cache_type = 0
query_cache_size = 0
max_connections = 500
thread_cache_size = 50
open_files_limit = 65535
table_definition_cache = 1024
table_open_cache = 2048
# INNODB #
innodb_flush_method = O_DIRECT
innodb_log_files_in_group = 2
innodb_log_file_size = 256M
innodb_flush_log_at_trx_commit = 2
innodb_file_per_table = 1
innodb_buffer_pool_size = 6G
# LOGGING #
log_error = /var/lib/mysql/mysql-error.log
log_queries_not_using_indexes = 1
slow_query_log = 1
slow_query_log_file = /var/lib/mysql/mysql-slow.log
错误日志
InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013. All Rights Reserved.
This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
131210 11:53:50 innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as 'root' (using password: YES).
131210 11:53:50 innobackupex: Connected to MySQL server
IMPORTANT: Please check that the backup run completes successfully.
At the end of a successful backup run innobackupex
prints "completed OK!".
innobackupex: Using mysql server version 5.6.14-log
innobackupex: Created backup directory /var/www/dyntest.dk
131210 11:53:50 innobackupex: Starting ibbackup with command: xtrabackup_56 --defaults-group="mysqld" --backup --suspend-at-end --target-dir=/tmp --tmpdir=/tmp --stream=tar
innobackupex: Waiting for ibbackup (pid=6728) to suspend
innobackupex: Suspend file '/tmp/xtrabackup_suspended_2'
xtrabackup_56 version 2.1.5 for MySQL server 5.6.11 Linux (x86_64) (revision id: undefined)
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /var/lib/mysql
xtrabackup: using the following InnoDB configuration:
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 = 2
xtrabackup: innodb_log_file_size = 50331648
InnoDB: Error: log file ./ib_logfile0 is of different size 268435456 bytes
InnoDB: than specified in the .cnf file 50331648 bytes!
innobackupex: Error: The xtrabackup child process has died at /usr/bin/innobackupex line 2579.
提示在最后的错误消息中,如下所示
xtrabackup 隐式引用的 my.cnf 具有 innodb_log_file_size = 48M(50331648 字节),但实际日志文件大小为 256MB(如您的 my.cnf 所示)
我认为您应该像这样明确指定 my.cnf
我遇到过同样的问题。修复很简单,只需在 [mysqld] 部分的 my.cnf 中添加以下内容 innodb_log_file_size=48M
(使用您需要的任何大小的日志文件,对于小型 Db 来说 48M 就可以了)
然后按照说明使用新的日志文件大小重新启动 mysql。基础是(但请阅读手册!) stop mysql remove the ib_logfile* files from /var/lib/mysql restart mysql
确保不要使用 innodb 快速关闭(阅读手册!)