MySQL MHA and Perl pathing

I am certainly not a knowledgeable Perl person, however I recently ran into the error Can’t locate MHA/MasterMonitor.pm on Red Hat 6.x. I have installed MySQL MHA on various systems before without any issues.

$ masterha_manager -version
Can't locate MHA/MasterMonitor.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/bin/masterha_manager line 26.
BEGIN failed--compilation aborted at /usr/bin/masterha_manager line 26.

The issue was that MySQL MHA is not installed in any of the acceptable default paths for this disto default installation.

$ find / -type d -name MHA
/usr/lib/perl5/vendor_perl/MHA

The fix was simple on this OS, but I expect there is a correct Perl approach?

ln -s /usr/lib/perl5/vendor_perl/MHA /usr/lib64/perl5/vendor_perl/
$ cat /etc/*release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Red Hat Enterprise Linux Server release 6.3 (Santiago)

Tags: ,

2 Responses to “MySQL MHA and Perl pathing”

  1. Hi Ronald,

    Standard perl module directory is different between RHEL5 and RHEL6. You need to use MHA RHEL5 rpm for RHEL5, and to use MHA RHEL6 rpm for RHEL6 (http://code.google.com/p/mysql-master-ha/downloads/list).

    MHA RHEL6 rpm installs perl modules under /usr/share/perl5/vendor_perl/, which is standard perl module location in RHEL6 so dependency problem should not happen.

  2. ronald says:

    Thanks Yoshinori,

    You are indeed right, here is what I ran on this server, and I am downloading the el5 version (command copied from previous installs), not the el6 version.

    cd /tmp
    sudo yum install -y http://fedora-epel.mirror.lstn.net/6/i386/epel-release-6-8.noarch.rpm
    sudo yum install -y perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager perl-Time-HiRes
    wget http://mysql-master-ha.googlecode.com/files/mha4mysql-manager-0.55-1.el5.noarch.rpm
    sudo rpm -ivh mha4mysql-manager-*.noarch.rpm
    # Needed in CentOS 6.x
    ln -s /usr/lib/perl5/vendor_perl/MHA /usr/lib64/perl5/vendor_perl/
    masterha_manager -version