본문 바로가기

리눅스

MHA NodeUtil.pm 에러

반응형

MHA NodeUtil.pm 에러

테스트 환경

$ lsb_release -d
Description:	Ubuntu 22.04.2 LTS

masterha_manager 버전

$ masterha_manager --version
masterha_manager version 0.58.

masterha_check_repl 테스트

$ masterha_check_repl --conf=/home/mhauser/mha/conf/mha.cnf
...
Wed May 24 20:27:49 2023 - [error][/usr/share/perl5/MHA/MasterMonitor.pm, ln427] Error happened on checking configurations. Redundant argument in sprintf at /usr/share/perl5/MHA/NodeUtil.pm line 201.
Wed May 24 20:27:49 2023 - [error][/usr/share/perl5/MHA/MasterMonitor.pm, ln525] Error happened on monitoring servers.
Wed May 24 20:27:49 2023 - [info] Got exit code 1 (Not master dead).
[error][/usr/share/perl5/MHA/MasterMonitor.pm, ln427] Error happened on checking configurations. Redundant argument in sprintf at /usr/share/perl5/MHA/NodeUtil.pm line 201.

해결 방법

vim /usr/share/perl5/MHA/NodeUtil.pm
193 sub parse_mysql_version($) {
194   my $str = shift;
195   ($str) =  $str =~ m/^[^-]*/g;
196   my $result = sprintf( '%03d%03d%03d', $str =~ m/(\d+)/g );
197   return $result;
198 }
199
200 sub parse_mysql_major_version($) {
201   my $str = shift;
202   ($str) =  $str =~ m/^[^-]*/g;
203   my $result = sprintf( '%03d%03d%03d', $str =~ m/(\d+)/g );
204   return $result;
205 }
$ diff -Nur /usr/share/perl5/MHA/NodeUtil.pm.bk /usr/share/perl5/MHA/NodeUtil.pm
--- /usr/share/perl5/MHA/NodeUtil.pm.bk	2023-05-24 20:24:16.386479270 +0900
+++ /usr/share/perl5/MHA/NodeUtil.pm	2023-05-24 20:29:29.444888184 +0900
@@ -192,13 +192,15 @@

 sub parse_mysql_version($) {
   my $str = shift;
+  ($str) =  $str =~ m/^[^-]*/g;
   my $result = sprintf( '%03d%03d%03d', $str =~ m/(\d+)/g );
   return $result;
 }

 sub parse_mysql_major_version($) {
   my $str = shift;
-  my $result = sprintf( '%03d%03d', $str =~ m/(\d+)/g );
+  ($str) =  $str =~ m/^[^-]*/g;
+  my $result = sprintf( '%03d%03d%03d', $str =~ m/(\d+)/g );
   return $result;
 }

 

728x90
반응형