4-1-5 MHA 报错

最后更新于:2022-04-02 07:43:57

# 报错 #### 报错:在Master上建立监控账户 ```shell grant all on *.* to 'root' @'192.168.1.%' identified by 'rootpassword'; ``` 否则,在MHA检查复制时,会报如下错误 ```shell [root@MHA mha]# masterha_check_repl --conf=/etc/mha/app1.cnf Tue Dec 23 16:21:52 2014 - [warning] Global configuration file /etc/mha_default.cnf not found. Skipping. Tue Dec 23 16:21:52 2014 - [info] Reading application default configurations from /etc/mha/app1.cnf.. Tue Dec 23 16:21:52 2014 - [info] Reading server configurations from /etc/mha/app1.cnf.. Tue Dec 23 16:21:52 2014 - [info] MHA::MasterMonitor version 0.55. Tue Dec 23 16:21:52 2014 - [error][/usr/local/share/perl5/MHA/ServerManager.pm, ln255] Got MySQL error when connecting 192.168.1.202(192.168.1.202:3306) :1045:Access denied for user 'root'@'192.168.1.203' (using password: YES), but this is not mysql crash. Check MySQL server settings. at /usr/local/share/perl5/MHA/ServerManager.pm line 251 Tue Dec 23 16:21:52 2014 - [error][/usr/local/share/perl5/MHA/ServerManager.pm, ln255] Got MySQL error when connecting 192.168.1.200(192.168.1.200:3306) :1045:Access denied for user 'root'@'192.168.1.203' (using password: YES), but this is not mysql crash. Check MySQL server settings. at /usr/local/share/perl5/MHA/ServerManager.pm line 251 Tue Dec 23 16:21:52 2014 - [error][/usr/local/share/perl5/MHA/ServerManager.pm, ln255] Got MySQL error when connecting 192.168.1.201(192.168.1.201:3306) :1045:Access denied for user 'root'@'192.168.1.203' (using password: YES), but this is not mysql crash. Check MySQL server settings. at /usr/local/share/perl5/MHA/ServerManager.pm line 251 Tue Dec 23 16:21:52 2014 - [error][/usr/local/share/perl5/MHA/ServerManager.pm, ln263] Got fatal error, stopping operations Tue Dec 23 16:21:52 2014 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln386] Error happend on checking configurations. at /usr/local/share/perl5/MHA/MasterMonitor.pm line 300 Tue Dec 23 16:21:52 2014 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln482] Error happened on monitoring servers. Tue Dec 23 16:21:52 2014 - [info] Got exit code 1 (Not master dead). ``` #### 报错:所有MySQL节点增加mysqlbinlog环境变量 ```shell echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/bashrc ;source /etc/bashrc ```如果不添加,在MHA在检查复制情况时会报如下错误 ```shell Tue Dec 23 16:22:18 2014 - [info] Master MHA Node version is 0.54. Tue Dec 23 16:22:18 2014 - [info] Checking recovery script configurations on the current master.. Tue Dec 23 16:22:18 2014 - [info] Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/var/lib/mysql --output_file=/tmp/save_binary_logs_test --manager_version=0.55 --start_file=mysql-bin.000003 Tue Dec 23 16:22:18 2014 - [info] Connecting to root@192.168.1.200(192.168.1.200).. Creating /tmp if not exists.. ok. Checking output directory is accessible or not.. ok. Binlog found at /var/lib/mysql, up to mysql-bin.000003 Tue Dec 23 16:22:19 2014 - [info] Master setting check done. Tue Dec 23 16:22:19 2014 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers.. Tue Dec 23 16:22:19 2014 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=192.168.1.201 --slave_ip=192.168.1.201 --slave_port=3306 --workdir=/tmp --target_version=5.5.32-log --manager_version=0.55 --relay_log_info=/var/lib/mysql/relay-log.info --relay_dir=/var/lib/mysql/ --slave_pass=xxx Tue Dec 23 16:22:19 2014 - [info] Connecting to root@192.168.1.201(192.168.1.201:22).. Can't exec "mysqlbinlog": No such file or directory at /usr/local/share/perl5/MHA/BinlogManager.pm line 99. mysqlbinlog version not found! at /usr/local/bin/apply_diff_relay_logs line 482 Tue Dec 23 16:22:20 2014 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln195] Slaves settings check failed! Tue Dec 23 16:22:20 2014 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln375] Slave configuration failed. Tue Dec 23 16:22:20 2014 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln386] Error happend on checking configurations. at /usr/local/bin/masterha_check_repl line 48 Tue Dec 23 16:22:20 2014 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln482] Error happened on monitoring servers. Tue Dec 23 16:22:20 2014 - [info] Got exit code 1 (Not master dead). MySQL Replication Health is NOT OK! ```
';