两台服务器10.11和10.40
今天使用xtrabackup备份还原的时候遇到问题,在10.11备份,10.40还原报错如下:
之前的备份还原是不需要添加该参数的,很奇怪,检查发现是备份的xtrbackup不是我经常使用的2.1.4,而是2.1.2,所以还原上面有些出入
解决:
在备份脚本执行后,我们可以通过查看该日志判断当前使用的xtrabackup版本
确定版本
# more xtrabackup_log_2014-11-25_10\:20\:23 //这是我们要使用的版本2.1.4-->percona-xtrabackup-2.1.4-656.rhel5.x86_64.rpm
xtrabackup_55 version 2.1.4 for Percona Server 5.5.31 Linux (x86_64) (revision id: 656)
# more xtrabackup_log_2014-11-24_16\:06\:55 、//摒弃该版本2.1.2
xtrabackup_55 version 2.1.2 for Percona Server 5.5.16 Linux (x86_64) (revision id: 611)
今天使用xtrabackup备份还原的时候遇到问题,在10.11备份,10.40还原报错如下:
# innobackupex --apply-log --redo-only --user=backupuser --password='123456'--defaults-file=/etc/my_ttnet.cnf /root/bh/backup/full/
InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona Ireland Ltd 2009-2012. All Rights Reserved.
This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
141125 09:43:44 innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as 'backupuser' (using password: YES).
Failed to connect to MySQL server to detect version.
You must set xtrabackup version to use with --ibbackup option.
Possible values are xtrabackup_55 (for MySQL 5.5), xtrabackup_56 (for MySQL or Percona Server 5.6, or xtrabackup (for MySQL 5.1 with InnoDB plugin or Percona Server)
根据报错提示,失败查明mysql的版本,需要指明--ibbackup选项,因为我的mysql是5.5版本的,所以我使用--ibbackup xtrabackup_55,
之前的备份还原是不需要添加该参数的,很奇怪,检查发现是备份的xtrbackup不是我经常使用的2.1.4,而是2.1.2,所以还原上面有些出入
解决:
# innobackupex --apply-log --redo-only --user=backupuser --password='123456'--defaults-file=/etc/my_ttnet.cnf /root/bh/backup/full --ibbackup xtrabackup_55
..........
xtrabackup: Error: cannot open ./xtrabackup_checkpoints
xtrabackup: error: xtrabackup_read_metadata()
...............
141125 9:59:20 InnoDB: Starting shutdown...
141125 9:59:21 InnoDB: Shutdown completed; log sequence number 2820572327720
141125 09:59:21 innobackupex: completed OK!
这里有个ERROR,检查发现在备份的时候就没有生成保有binlog_pos和file信息的文件,我晕啊,于是改用2.1.4版本的xtrabackup重新进行备份。
在备份脚本执行后,我们可以通过查看该日志判断当前使用的xtrabackup版本
确定版本
# more xtrabackup_log_2014-11-25_10\:20\:23 //这是我们要使用的版本2.1.4-->percona-xtrabackup-2.1.4-656.rhel5.x86_64.rpm
xtrabackup_55 version 2.1.4 for Percona Server 5.5.31 Linux (x86_64) (revision id: 656)
# more xtrabackup_log_2014-11-24_16\:06\:55 、//摒弃该版本2.1.2
xtrabackup_55 version 2.1.2 for Percona Server 5.5.16 Linux (x86_64) (revision id: 611)