Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Common errors in MHA and their Solutions

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Error 1

Run masterha_check_repl-conf=/etc/masterha/app1.cnf to report an error

Testing mysql connection and privileges..sh: mysql: command not found

Mysql command failed with rc 127:0!

At / usr/bin/apply_diff_relay_logs line 375

Solution: ln-s / usr/local/mysql/bin/mysql / usr/bin

Error 2

Run masterha_check_repl-conf=/etc/masterha/app1.cnf to report an error

Can't exec "mysqlbinlog": No such file or directory at / usr/local/perl5/MHA/BinlogManager.pm line 99.

Solution: execute which mysqlbinlog on the node node, for example, my result is

[localhost~] $which mysqlbinlog

/ usr/local/mysql/bin/mysqlbinlog

Ln-s / usr/local/mysql/bin/mysqlbinlog / usr/bin/mysqlbinlog

Error 3

Run master_check_ssh-conf=/etc/masterha/aap1.cnf to report an error

Connection via SSH fromroot@192.168.17.199toroot@192.168.17.200...

Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)

[error] [/ usr/local/share/perl5/MHA/SSHcheck.pm,ln163]

Solution: generally, there is a problem with the public key, and the relevant ip content in / root/.ssh/known_hosts needs to be deleted and regenerated to ok.

Error 4

Run master_check_ssh-conf=/etc/masterha/aap1.cnf to report an error

Sun Nov 20 20:10:59 2016-[info] Executing command: save_binary_logs-command=test-start_pos=4-binlog_dir=/data/mysqllog/3306-output_file=/masterha/app1/save_binary_logs_test-manager_version=0.55-start_file=mysql-bin.000001

Sun Nov 20 20:10:59 2016-[info] Connecting to root@172.18.3.180 (172.18.3.180)..

Failed to save binary log: Binlog not found from / data/mysqllog/3306! If you got this error at MHA Manager, please set "master_binlog_dir=/path/to/binlog_directory_of_the_master" correctly in the MHA Manager's configuration file and try again.

At / usr/bin/save_binary_logs line 117.

Eval {...} called at / usr/bin/save_binary_logs line 66

Main::main () called at / usr/bin/save_binary_logs line 62

Sun Nov 20 20:10:59 2016-[error] [/ usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln154] Master setting check failed!

Sun Nov 20 20:10:59 2016-[error] [/ usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln367] Master configuration failed.

Sun Nov 20 20:10:59 2016-[error] [/ usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln386] Error happend on checking configurations. At / usr/bin/masterha_check_repl line 48.

Sun Nov 20 20:10:59 2016-[error] [/ usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln482] Error happened on monitoring servers.

Sun Nov 20 20:10:59 2016-[info] Got exit code 1 (Not master dead).

Solution:

The datadir path in / etc/masterha/aap1.cnf should be the location of bin-log in mysql

Error 5

Run masterha_check_repl-conf=/etc/masterha/app1.cnf to report an error

Mon Nov 21 11:11:40 2016-[info] MHA::MasterRotate version 0.55.

Mon Nov 21 11:11:40 2016-[info] Starting online master switch..

Mon Nov 21 11:11:40 2016-[info]

Mon Nov 21 11:11:40 2016-[info] * Phase 1: Configuration Check Phase..

Mon Nov 21 11:11:40 2016-[info]

Mon Nov 21 11:11:40 2016-[warning] Global configuration file / etc/masterha_default.cnf not found. Skipping.

Mon Nov 21 11:11:40 2016-[info] Reading application default configurations from / etc/masterha/app1.cnf..

Mon Nov 21 11:11:40 2016-[info] Reading server configurations from / etc/masterha/app1.cnf..

Mon Nov 21 11:11:40 2016-[error] [/ usr/share/perl5/vendor_perl/MHA/ServerManager.pm, ln604] There are 2 non-slave servers! MHA manages at most one non-slave server. Check configurations.

Mon Nov 21 11:11:40 2016-[error] [/ usr/share/perl5/vendor_perl/MHA/ManagerUtil.pm, ln178] Got ERROR: at / usr/share/perl5/vendor_perl/MHA/MasterRotate.pm line 85.

Solution:

Manually make the repaired master into a new master slave server

Warning 1

Relay_log_purge=0 should be set for each slave library.

# otherwise receive the following alarm message # # mysql-e 'set global relay_log_purge=0' dynamically modify this parameter, because slave will be upgraded to master at any time

[warning] relay_log_purge=0 is not set on slave (172.18.3.140 3306).

Warning 2

Set read_only=1 for each slave library

# otherwise receive the following alarm message # # mysql-e 'set global read_only=1' dynamically modify this parameter, because slave will be upgraded to master at any time.

[info] read_only=1 is not set on slave (172.18.3.107 3306

[root@centos7-04] # masterha_check_repl-- conf=/etc/masterha/app1.cnf

Question 1:

Thu Aug 23 04:39:01 2018-[warning] log-bin is not set on slave 192.168.0.189 (192.168.0.189) This host cannot be a master.

Thu Aug 23 04:39:01 2018-[warning] log-bin is not set on slave 192.168.0.190 (192.168.0.190) This host cannot be a master.

Solution:

Each client of the slave library should open binlog, that is, log_bin=on, and both should be enabled from above

[root@centos7-02 ~] # vi / etc/my.cnf

Basedir = / usr/local/mysql

Datadir = / data/mysql

Socket = / tmp/mysql.sock

Server-id=189

Log_bin=on

Question 2:

Can't exec "mysqlbinlog": there is no such file or directory at / usr/local/share/perl5/MHA/BinlogManager.pm line 106.

Mysqlbinlog version command failed with rc 1:0, please verify PATH, LD_LIBRARY_PATH, and client options

At / usr/local/bin/apply_diff_relay_logs line 493.

Solution:

Execute the following command on all nodes

[root@centos7-01 ~] # ln-s / usr/local/mysql/bin/mysqlbinlog / usr/local/bin/mysqlbinlog

[root@centos7-01 ~] # ln-s / usr/local/mysql/bin/mysql / usr/local/bin/mysql

[root@centos7-02 ~] # ln-s / usr/local/mysql/bin/mysqlbinlog / usr/local/bin/mysqlbinlog

[root@centos7-02 ~] # ln-s / usr/local/mysql/bin/mysql / usr/local/bin/mysql

[root@centos7-03 ~] # ln-s / usr/local/mysql/bin/mysqlbinlog / usr/local/bin/mysqlbinlog

[root@centos7-03 ~] # ln-s / usr/local/mysql/bin/mysql / usr/local/bin/mysql

Question 3:

Thu Aug 23 05:41:59 2018-[error] [/ usr/local/share/perl5/MHA/MasterMonitor.pm, ln226] Failed to get master_ip_failover_script status with return code 1:0.

Thu Aug 23 05:41:59 2018-[error] [/ usr/local/share/perl5/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations. At / usr/local/bin/masterha_check_repl line 48

Thu Aug 23 05:41:59 2018-[error] [/ usr/local/share/perl5/MHA/MasterMonitor.pm, ln523] Error happened on monitoring servers.

Solution:

[root@centos7-04] # vi / etc/masterha/app1.cnf

# master_ip_failover_script= / usr/local/bin/master_ip_failover / / comment this option temporarily, then enable it after introducing keepalived and modifying the script

Note: there are two ways to Failover: one is the virtual IP address, the other is the global configuration file. MHA does not limit which method to use, but allows users to choose the way in which virtual IP addresses involve other software, such as keepalive software, and modify the script master_ip_failover.

Question 4:

Thu Aug 23 18:17:14 2018-[error] [/ usr/local/share/perl5/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations. Can't exec "/ usr/local/bin/master_ip_failover": insufficient permissions for at / usr/local/share/perl5/MHA/ManagerUtil.pm line 68.

Thu Aug 23 18:17:14 2018-[error] [/ usr/local/share/perl5/MHA/MasterMonitor.pm, ln523] Error happened on monitoring servers.

Solution:

Chmod + x / usr/local/bin/master_ip_failover

Question 5:

[error] [/ usr/local/share/perl5/MHA/ServerManager.pm, ln492] Server 192.168.0.190 (192.168.0.190) is dead, but must be alive! Check server settings.

Solution:

[root@centos7-04 ~] # rm-rf / var/log/masterha/app1.log/app1.failover.complete # Delete this file on the MHA management machine

Question 6:

[error] [/ usr/local/share/perl5/MHA/ServerManager.pm, ln492] Server 192.168.0.190 (192.168.0.190) is dead, but must be alive! Check server settings.

Solution:

Clear firewall rules

Question 7:

[error] [/ usr/local/share/perl5/MHA/ServerManager.pm, ln492] Server 192.168.0.188 (192.168.0.188) is dead, but must be alive! Check server settings.

Fri Aug 24 23:50:37 2018-[error] [/ usr/local/share/perl5/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations. At / usr/local/share/perl5/MHA/MasterMonitor.pm line 399

Solution:

Restart the mysql service of the main library

Question 8:

[error] [/ usr/local/share/perl5/MHA/MasterMonitor.pm, ln205] Slaves settings check failed!

Solution:

Log in to the slave database to see if the master database is set by yourself.

Mysql > show slave status\ G

Master_Server_Id: 189

Question 9:

[error] [/ usr/local/share/perl5/MHA/ServerManager.pm, ln781] Multi-master configuration is detected, but two or more masters are either writable (read-only is not set) or dead! Check configurations for details. Master configurations are as below:

Master 192.168.0.189 (192.168.0.189 3306), dead

Master 192.168.0.188 (192.168.0.188), replicating from 192.168.0.189 (192.168.0.189)

Solution:

All execution from above

Mysql-uroot-p-e "set global read_only=1"

Question 10:

Mysqlbinlog: unknown variable 'default-character-set=utf8'

Mysqlbinlog version command failed with rc 7:0, please verify PATH, LD_LIBRARY_PATH, and client options

Solution:

Comment out the clinet segment default-character-set=utf8mb4 on all slave servers

Change the default character set UTF8 to utf8mb4

[client]

# default-character-set = utf8mb4

[mysql]

Default-character-set = utf8mb4

[mysqld]

Character-set-client-handshake = FALSE

Character-set-server = utf8mb4

Collation-server = utf8mb4_unicode_ci

Init_connect='SET NAMES utf8mb4'

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report