【xtrabackup故障】Failed to connect to MySQL to detect version

xjywp00 2019-06-25

今天在做数据库备份数据遇到一个问题,主要原因是:备份和恢复的时候使用的xtrabackup的版本不一致

问题

使用xtrabackup校验数据的时候报错:

# innobackupex --apply-log /data/back/  
  
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.6版本的,所以我使用--ibbackup xtrabackup_56,
之前的备份还原是不需要添加该参数的,很奇怪,检查发现是备份的xtrbackup不是我经常使用的2.4,而是2.1.9,所以还原上面有些出入

解决:

# innobackupex --use-memory=1G --apply-log /data/back --ibbackup xtrabackup_56  

................................................... 
InnoDB: 5.6.17 started; log sequence number 3974285875212
[notice (again)]
  If you use binary log and don't use any hack of group commit,
  the binary log position seems to be:
InnoDB: Last MySQL binlog file position 0 365497561, file name mysql-bin.003475

xtrabackup: starting shutdown with innodb_fast_shutdown = 1
InnoDB: FTS optimize thread exiting.
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 3974285876610
171011 09:43:10  innobackupex: completed OK!

相关推荐