在上一篇《从零开始配置MySQL MMM》中,在64bit的RHEL6中安装和配置MySQL-mmm。这两天又拿到了一个全32bit的CentOS 5,在配置过程中有遇到了一些其他问题。
因为这个环境中无法通过yum直接安装mysql-mmm,所以只有通过下载安装文件进行安装。而在安装mmm之前,需要安装其所依赖的库文件。为了方便起见,并没有对monitor和database host区别对待,统一安装了所有的依赖。
首先是安装perl及其库文件:
# yum -y install perl*
# Clear all previous downlowds rm -rf mmm_deps # Create a new folder for downlowds mkdir mmm_deps cd mmm_deps # download all modules wget http://download.fedora.redhat.com/pub/epel/5/i386/rrdtool-1.2.27-3.el5.i386.rpm wget http://download.fedora.redhat.com/pub/epel/5/i386/rrdtool-perl-1.2.27-3.el5.i386.rpm wget http://mirror.centos.org/centos/5/os/i386/CentOS/libart_lgpl-2.3.17-4.i386.rpm wget http://mirror.centos.org/centos/5/updates/i386/RPMS/freetype-2.2.1-28.el5_7.2.i386.rpm wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/perl-Proc-Daemon-0.03-1.2.el5.rf.noarch.rpm wget http://download.fedora.redhat.com/pub/epel/5/i386/perl-XML-DOM-1.44-2.el5.noarch.rpm wget http://download.fedora.redhat.com/pub/epel/5/i386/perl-XML-RegExp-0.03-2.el5.noarch.rpm wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/perl-Log-Log4perl-RRDs-1.13-1.el5.rf.noarch.rpm wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/perl-Log-Log4perl-1.13-1.el5.rf.noarch.rpm wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/perl-IPC-Shareable-0.60-1.2.el5.rf.noarch.rpm wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/perl-Log-Dispatch-2.26-1.el5.rf.noarch.rpm wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/perl-Params-Validate-0.95-1.el5.rf.i386.rpm wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/perl-Log-Dispatch-FileRotate-1.19-1.el5.rf.noarch.rpm wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/perl-Algorithm-Diff-1.1902-1.el5.rf.noarch.rpm wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/perl-Net-ARP-1.0.6-1.el5.rf.i386.rpm # install all modules rpm -Uvh freetype-2.2.1-28.el5_7.2.i386.rpm rpm -Uvh perl-Params-Validate-0.95-1.el5.rf.i386.rpm rpm -Uvh libart_lgpl-2.3.17-4.i386.rpm rpm -Uvh rrdtool-1.2.27-3.el5.i386.rpm rpm -Uvh rrdtool-perl-1.2.27-3.el5.i386.rpm rpm -Uvh perl-Algorithm-Diff-1.1902-1.el5.rf.noarch.rpm rpm -Uvh perl-Log-Dispatch-2.26-1.el5.rf.noarch.rpm rpm -Uvh perl-Log-Dispatch-FileRotate-1.19-1.el5.rf.noarch.rpm rpm -Uvh perl-IPC-Shareable-0.60-1.2.el5.rf.noarch.rpm rpm -Uvh perl-XML-RegExp-0.03-2.el5.noarch.rpm rpm -Uvh perl-XML-DOM-1.44-2.el5.noarch.rpm rpm -Uvh perl-Log-Log4perl-1.13-1.el5.rf.noarch.rpm rpm -Uvh perl-Log-Log4perl-RRDs-1.13-1.el5.rf.noarch.rpm rpm -Uvh perl-Proc-Daemon-0.03-1.2.el5.rf.noarch.rpm rpm -Uvh perl-Net-ARP-1.0.6-1.el5.rf.i386.rpm上面基本可以覆盖所有不能通过yum安装的依赖文件了。如果在启动过程还是提示某些依赖无法找到,可以通过: http://pkgs.org/ 搜索下载后安装,不过要注意保持版本一致。
在解决mysql-mmm-monitor启动时遇到的问题时,可以将/etc/mysql-mmm/mmm_mon.conf中debug设为1,可以查看详细的错误信息。
错误1:在/var/log/mysql-mmm/mmm_mon.log中看到
FATAL Can't open pid file '/var/run/mysql-mmm/mmm_mond.pid' for writing!因为/var/run下面不存在mysql-mmm目录,所以无法写入mmm_mond.pid,新建即可。
错误2:
open2: exec of /usr/libexec/mysql-mmm/monitor/checker ping_ip failed at /usr/lib/perl5/vendor_perl/5.8.8/MMM/Monitor/Checker.pm line 143
错误3:启动后无法连接到database host,通过mmm_control show查看:
# mmm_control show # Warning: agent on host db01 is not reachable # Warning: agent on host db02 is not reachable # Warning: agent on host db03 is not reachable # Warning: agent on host db04 is not reachable db01(192.168.105.86) master/AWAITING_RECOVERY. Roles: db02(192.168.105.87) master/AWAITING_RECOVERY. Roles: db03(192.168.105.88) slave/AWAITING_RECOVERY. Roles: db04(192.168.105.89) slave/AWAITING_RECOVERY. Roles:
FATAL Can't open pid file '/var/run/mysql-mmm/mmm_agentd.pid' for writing!