innobackupex: Error: Failed to connect to MySQL server as DBD

本文详细记录了在使用Percona XtraBackup最新版本时遇到的三个问题及解决方案:1. 安装Perl-DBD-MySQL模块以解决连接MySQL失败问题;2. 正确指定--defaults-file参数避免备份路径问题;3. 检查并创建指定备份目录以解决路径不存在导致的错误。通过这些步骤,成功解决了Percona XtraBackup在新环境部署过程中的挑战。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

新环境上测试percona-xtrabackup-2.2.5-Linux-x86_64新版本,出现以下几个问题.

 

下载地址:

wget http://www.percona.com/redir/downloads/XtraBackup/LATEST/binary/tarball/percona-xtrabackup-2.2.5-5027-Linux-x86_64.tar.gz

 

1. 没安装perl-DBD-MySQL
$innobackupex --defaults-file=/db/mysql5.6/my.cnf -user=bkpuser  -password=s3cret   -socket=/db/mysql5.6/mysql.sock /home/mysql

innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_file=/db/mysql5.6/my.cnf;mysql_read_default_group=xtrabackup' as 'bkpuser'  (using password: YES).
innobackupex: Error: Failed to connect to MySQL server as DBD::mysql module is not installed at /usr/bin/innobackupex line 2960.

根据操作系统的版本安装合适的perl-DBD-MySQL后问题解决
# rpm -ivh perl-DBD-MySQL-4.013-3.el6.x86_64.rpm


2.没指定--defaults-file参数
innobackupex  -user=bkpuser  -password=s3cret   -socket=/db/mysql5.6/mysql.sock /home/mysqlweb

错误如下:
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.

Get the latest version of Percona XtraBackup, documentation, and help resources:
http://www.percona.com/xb/p

141022 17:33:37  innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;mysql_socket=/db/mysql5.6/mysql.sock' as 'bkpuser'  (using password: YES).
141022 17:33:37  innobackupex: Connected to MySQL server
141022 17:33:37  innobackupex: Executing a version check against the server...
141022 17:33:37  innobackupex: Done.
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.17-log

innobackupex: Created backup directory /home/mysqlweb/2014-10-22_17-33-37

141022 17:33:37  innobackupex: Starting ibbackup with command: xtrabackup  --defaults-group="mysqld" --backup --suspend-at-end --target-dir=/home/mysqlweb/2014-10-22_17-33-37 --tmpdir=/tmp --extra-lsndir='/tmp'
innobackupex: Waiting for ibbackup (pid=20882) to suspend
innobackupex: Suspend file '/home/mysqlweb/2014-10-22_17-33-37/xtrabackup_suspended_2'

xtrabackup version 2.2.5 based on MySQL server 5.6.21 Linux (x86_64) (revision id: )
xtrabackup: uses posix_fadvise().
xtrabackup: cd to
xtrabackup: open files limit requested 0, set to 10240
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
2014-10-22 17:33:37 7f4783e7b720  InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: File ./ib_logfile0: 'open' returned OS error 71. Cannot continue operation
innobackupex: Error: The xtrabackup child process has died at /usr/bin/innobackupex line 2681.


3.指定的备份路径不存在
$innobackupex  -user=bkpuser  -password=s3cret   -socket=/db/mysql5.6/mysql.sock /home/mysql

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.

Get the latest version of Percona XtraBackup, documentation, and help resources:
http://www.percona.com/xb/p

141022 17:35:03  innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;mysql_socket=/db/mysql5.6/mysql.sock' as 'bkpuser'  (using password: YES).
141022 17:35:03  innobackupex: Connected to MySQL server
141022 17:35:03  innobackupex: Executing a version check against the server...
141022 17:35:03  innobackupex: Done.
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.17-log
innobackupex: Error: Failed to create backup directory /home/mysql/2014-10-22_17-35-03: No such file or directory at /usr/bin/innobackupex line 3949.

备忘,以记之。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值