使用xtrabackup恢复mysql的物理备份

时间:2013-07-11 10:25:28

标签: mysql upgrade database-restore

我备份mysql数据库,然后尝试使用xtrabackup在以后的版本中恢复它,mysql服务无法启动。

旧的mysql版本:5.0.90;

新版本:5.5.31

恢复步骤:

  1. innobackupex --use-memory=4G --apply-log /data/backups/2010-03-13_02-42-44/

  2. innobackupex --copy-back /data/backups/2010-03-13_02-42-44/

    第二步显示xtrabackup完全恢复了mysql数据库。

  3. sudo mysql service start mysql

  4. 我尝试启动mysql服务,它显示“作业无法启动”.i检查这些数据库文件的权限,如下所示。

    -rw-r--r-- 1 mysql mysql  209715200  7月 11 06:02 ibdata1
    -rw-r--r-- 1 mysql mysql 1048576000  7月 11 06:03 ib_logfile0
    -rw-r--r-- 1 mysql mysql 1048576000  7月 11 06:03 ib_logfile1
    drwxr-xr-x 2 mysql mysql       4096  7月 11 06:02 mysql
    drwxr-xr-x 2 mysql mysql      12288  7月 11 06:02 sp5084afbe48ce9
    drwxr-xr-x 2 mysql mysql       4096  7月 11 06:02 test
    -rw-r--r-- 1 mysql mysql         52  7月 11 06:02 xtrabackup_binlog_pos_innodb
    -rw-r--r-- 1 mysql mysql         76  7月 11 06:02 xtrabackup_slave_info
    

    这是错误:

    InnoDB: Error: log file ./ib_logfile0 is of different size 0 1048576000 bytes
    InnoDB: than specified in the .cnf file 0 5242880 bytes!
    130711  6:08:56 [ERROR] Plugin 'InnoDB' init function returned error.
    130711  6:08:56 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    130711  6:08:56 [ERROR] Unknown/unsupported storage engine: InnoDB
    130711  6:08:56 [ERROR] Aborting
    
    130711  6:08:56 [Note] /usr/sbin/mysqld: Shutdown complete
    

1 个答案:

答案 0 :(得分:2)

检查/etc/mysql/my.cnf并查找

innodb_log_file_size = 5M

并将其更改为

innodb_log_file_size = 1000M

原因1048576000 / 1024/1024 = 1000,这就是InnoDB引擎对日志文件大小的期望。

similar problem