在上一篇《从零开始配置MySQL MMM》中,在64bit的RHEL6中安装和配置MySQL-mmm。这两天又拿到了一个全32bit的CentOS 5,在配置过程中有遇到了一些其他问题。
一、依赖问题
因为这个环境中无法通过yum直接安装mysql-mmm,所以只有通过下载安装文件进行安装。而在安装mmm之前,需要安装其所依赖的库文件。为了方便起见,并没有对monitor和database host区别对待,统一安装了所有的依赖。
首先是安装perl及其库文件:
# yum -y install perl*
因为之前被依赖问题折磨的够呛,所以这次一股脑地全都装上了。可是,还是想的太简单了,再启动时还是提示找不到Proc::Daemon或者Log::Log4Perl。找了好长时间,终于集齐了所有依赖,写了下面的安装文件:
# 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遇到的问题
在解决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
通过find命令搜索发现,checker的实际位置是在/usr/lib/mysql-mmm/monitor下,于是修改mmm_mon.conf文件,重新设置bin_path为/usr/lib/mysql-mmm即可。
错误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:
在上次出现了同样的问题,telnet得到“Connection refused”。登录database host检查mysql-mmm-agent状态,原来没有启动,在/var/log/mysql-mmm/mmm_agent.log中,有如下信息:
FATAL Can't open pid file '/var/run/mysql-mmm/mmm_agentd.pid' for writing!
和错误1相同的情况,在/var/run下面新建一个mysql-mmm目录,重新启动mysql-mmm-agent即可。