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 problems and Solutions of MySQL MHA configuration

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "common problems and solutions of MySQL MHA configuration". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "common problems and solutions to MySQL MHA configuration".

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'

Thank you for reading, the above is the content of "Common problems and Solutions of MySQL MHA configuration". After the study of this article, I believe you have a deeper understanding of the common problems and solutions of MySQL MHA configuration, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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