最近的MHA验证时,遭遇了DBD::mysql::dr::imp_data_size unexpectedly这个错误。而DBD这个包已经是安装过了的。下面是这个问题的描述和解决方案。
1、故障描述
# masterha_check_repl --conf=/etc/app1.cnf
Mon Feb 16 19:56:29 2015 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Mon Feb 16 19:56:29 2015 - [info] Reading application default configuration from /etc/app1.cnf..
Mon Feb 16 19:56:29 2015 - [info] Reading server configuration from /etc/app1.cnf..
Mon Feb 16 19:56:29 2015 - [info] MHA::MasterMonitor version 0.56.
Had to create DBD::mysql::dr::imp_data_size unexpectedly at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/DBI.pm line 1190.
Had to create DBD::mysql::db::imp_data_size unexpectedly at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/DBI.pm line 1190.
Mon Feb 16 19:56:29 2015 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterMonitor.pm, ln326] Undefined subroutine &DBD::mysql::db::_login called at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql.pm line 140.
at /usr/lib/perl5/site_perl/5.8.8/MHA/Server.pm line 166
Had to create DBD::mysql::dr::imp_data_size unexpectedly at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/DBI.pm line 1190.
Had to create DBD::mysql::db::imp_data_size unexpectedly at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/DBI.pm line 1190.
Mon Feb 16 19:56:29 2015 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterMonitor.pm, ln326] Undefined subroutine &DBD::mysql::db::_login called at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql.pm line 140.
at /usr/lib/perl5/site_perl/5.8.8/MHA/Server.pm line 166
Had to create DBD::mysql::dr::imp_data_size unexpectedly at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/DBI.pm line 1190.
Had to create DBD::mysql::db::imp_data_size unexpectedly at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/DBI.pm line 1190.
Mon Feb 16 19:56:29 2015 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterMonitor.pm, ln326] Undefined subroutine &DBD::mysql::db::_login called at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql.pm line 140.
at /usr/lib/perl5/site_perl/5.8.8/MHA/Server.pm line 166
Mon Feb 16 19:56:29 2015 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterMonitor.pm, ln326] Got fatal error, stopping operations
Mon Feb 16 19:56:29 2015 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterMonitor.pm, ln520] Error happened on checking configurations. at /usr/lib/perl5/site_perl/5.8.8/MHA/MasterMonitor.pm line 326
Mon Feb 16 19:56:29 2015 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterMonitor.pm, ln691] Error happened on monitoring servers.
Mon Feb 16 19:56:29 2015 - [info] Got exit code 1 (Not master dead).
MySQL Replication Health is NOT OK!
2、故障解决
###查看当前系统的dbi与dbd包,如下表明2个包都已安装
# rpm -qa|grep -i dbi
perl-DBI-1.52-2.el5
# rpm -qa|grep -i dbd
perl-DBD-Pg-1.49-4.el5_8
perl-DBD-MySQL-3.0007-2.el5
###我们首先卸载这2个rpm包
# rpm -e --nodeps perl-DBI-1.52-2.el5
# rpm -e --nodeps perl-DBD-MySQL-3.0007-2.el5
###下面使用yum方式分别安装这2个包
# yum install perl-DBI
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirrors.cug.edu.cn
* epel: mirrors.ustc.edu.cn
* extras: mirrors.hust.edu.cn
* updates: mirrors.hust.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package perl-DBI.x86_64 0:1.52-2.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================
Package Arch Version Repository Size
===================================================================================================
Installing:
perl-DBI x86_64 1.52-2.el5 base 600 k
Transaction Summary
===================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 600 k
Is this ok [y/N]: y
Downloading Packages:
perl-DBI-1.52-2.el5.x86_64.rpm | 600 kB 00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-DBI 1/1
Installed:
perl-DBI.x86_64 0:1.52-2.el5
Complete!
# yum install perl-DBD-mysql
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirrors.cug.edu.cn
* epel: mirrors.ustc.edu.cn
* extras: mirrors.hust.edu.cn
* updates: mirrors.hust.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package perl-DBD-MySQL.x86_64 0:3.0007-2.el5 set to be updated
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15)(64bit) for package: perl-DBD-MySQL
--> Processing Dependency: libmysqlclient.so.15()(64bit) for package: perl-DBD-MySQL
--> Running transaction check
---> Package mysql.x86_64 0:5.0.95-5.el5_9 set to be updated
--> Finished Dependency Resolution
-- Author: Leshami
-- Blog : http://blog.csdn.net/leshami
Dependencies Resolved
==========================================================================================
Package Arch Version Repository Size
==========================================================================================
Installing:
perl-DBD-MySQL x86_64 3.0007-2.el5 base 148 k
Installing for dependencies:
mysql x86_64 5.0.95-5.el5_9 base 4.9 M
Transaction Summary
==========================================================================================
Install 2 Package(s)
Upgrade 0 Package(s)
Total size: 5.0 M
Total download size: 148 k
Is this ok [y/N]: y
Downloading Packages:
perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm | 148 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : mysql 1/2
Installing : perl-DBD-MySQL 2/2
Installed:
perl-DBD-MySQL.x86_64 0:3.0007-2.el5
Dependency Installed:
mysql.x86_64 0:5.0.95-5.el5_9
Complete!
###安装后正常。