Mysql 简单问题汇总(持续更新)
主从架构相关问题
问题现象:从机连接主机时报错
[ERROR] Slave I/O: error connecting to master 'repl@192.168.0.50:3306' - retry-time: 60 retries: 1, Error_code: 2003
可能的原因有:
a、网络不通(是否打开防火墙)
b、复制用户的密码不对
c、指定的master_port端口不对
d、master上的mysql-bin.xxxxxx被误删
e、主库磁盘空间满了
MHA相关问题
问题现象:
[root@DBproxy app1]# masterha_check_ssh --conf=/data/masterha/app1/app1.cnf
Can't locate MHA/SSHCheck.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_check_ssh line 25.
BEGIN failed--compilation aborted at /usr/bin/masterha_check_ssh line 25.
[root@DBproxy app1]#
问题定位:应该是环境变量的问题
[root@DBproxy app1]# find / -name SSHCheck.pm
/usr/lib/perl5/vendor_perl/MHA/SSHCheck.pm
将相关路径加入PERL5LIB后,问题解决(根本原因是MHA和OS版本不匹配)。
export PERL5LIB=$PERL5LIB:/usr/lib/perl5/vendor_perl/
问题现象:
[root@DBproxy mysql]# masterha_check_repl --conf=/data/masterha/app1/app1.cnf
........
Fri Jul 15 17:40:59 2016 - [error][/usr/lib/perl5/vendor_perl/MHA/ManagerUtil.pm, ln123]
Can't locate MHA/BinlogManager.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/apply_diff_relay_logs line 24.
BEGIN failed--compilation aborted at /usr/bin/apply_diff_relay_logs line 24.
Fri Jul 15 17:40:59 2016 - [error][/usr/lib/perl5/vendor_perl/MHA/ManagerUtil.pm, ln150] node version on 192.168.0.60 not found! Is MHA Node package installed ?
at /usr/lib/perl5/vendor_perl/MHA/MasterMonitor.pm line 374
Fri Jul 15 17:40:59 2016 - [error][/usr/lib/perl5/vendor_perl/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations. Died at /usr/lib/perl5/vendor_perl/MHA/ManagerUtil.pm line 151.
Fri Jul 15 17:40:59 2016 - [error][/usr/lib/perl5/vendor_perl/MHA/MasterMonitor.pm, ln523] Error happened on monitoring servers.
Fri Jul 15 17:40:59 2016 - [info] Got exit code 1 (Not master dead).
MySQL Replication Health is NOT OK!
[root@DBproxy mysql]#
问题定位:设置环境变量export PERL5LIB=$PERL5LIB:/usr/lib/perl5/vendor_perl后问题依然没解决。
最后安装版本为el6的MHA(导致问题的版本为el5,该版本的MHA安装目录为/usr/lib/perl5/vendor_perl下),问题解决。