masterha_check_repl -conf=/etc/masterha/app1.cnf报错,显示如下
[root@manager scripts]# masterha_check_repl -conf=/etc/masterha/app1.cnf Tue Sep 7 02:59:56 2021 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping. Tue Sep 7 02:59:56 2021 - [info] Reading application default configuration from /etc/masterha/app1.cnf.. Tue Sep 7 02:59:56 2021 - [info] Reading server configuration from /etc/masterha/app1.cnf.. Tue Sep 7 02:59:56 2021 - [info] MHA::MasterMonitor version 0.57. Tue Sep 7 02:59:57 2021 - [info] GTID failover mode = 0 Tue Sep 7 02:59:57 2021 - [info] Dead Servers: Tue Sep 7 02:59:57 2021 - [info] Alive Servers: Tue Sep 7 02:59:57 2021 - [info] 192.168.122.10(192.168.122.10:3306) Tue Sep 7 02:59:57 2021 - [info] 192.168.122.11(192.168.122.11:3306) Tue Sep 7 02:59:57 2021 - [info] 192.168.122.12(192.168.122.12:3306) Tue Sep 7 02:59:57 2021 - [info] Alive Slaves: Tue Sep 7 02:59:57 2021 - [info] 192.168.122.11(192.168.122.11:3306) Version=5.7.17-log (oldest major version between slaves) log-bin:enabled Tue Sep 7 02:59:57 2021 - [info] Replicating from 192.168.122.10(192.168.122.10:3306) Tue Sep 7 02:59:57 2021 - [info] Primary candidate for the new Master (candidate_master is set) Tue Sep 7 02:59:57 2021 - [info] 192.168.122.12(192.168.122.12:3306) Version=5.7.17-log (oldest major version between slaves) log-bin:enabled Tue Sep 7 02:59:57 2021 - [info] Replicating from 192.168.122.10(192.168.122.10:3306) Tue Sep 7 02:59:57 2021 - [info] Current Alive Master: 192.168.122.10(192.168.122.10:3306) Tue Sep 7 02:59:57 2021 - [info] Checking slave configurations.. Tue Sep 7 02:59:57 2021 - [warning] relay_log_purge=0 is not set on slave 192.168.122.11(192.168.122.11:3306). Tue Sep 7 02:59:57 2021 - [warning] relay_log_purge=0 is not set on slave 192.168.122.12(192.168.122.12:3306). Tue Sep 7 02:59:57 2021 - [info] Checking replication filtering settings.. Tue Sep 7 02:59:57 2021 - [info] binlog_do_db= , binlog_ignore_db= Tue Sep 7 02:59:57 2021 - [info] Replication filtering check ok. Tue Sep 7 02:59:57 2021 - [info] GTID (with auto-pos) is not supported Tue Sep 7 02:59:57 2021 - [info] Starting SSH connection tests.. Tue Sep 7 03:00:00 2021 - [info] All SSH connection tests passed successfully. Tue Sep 7 03:00:00 2021 - [info] Checking MHA Node version.. Tue Sep 7 03:00:00 2021 - [info] Version check ok. Tue Sep 7 03:00:00 2021 - [info] Checking SSH publickey authentication settings on the current master.. Tue Sep 7 03:00:00 2021 - [info] HealthCheck: SSH to 192.168.122.10 is reachable. Tue Sep 7 03:00:00 2021 - [info] Master MHA Node version is 0.57. Tue Sep 7 03:00:00 2021 - [info] Checking recovery script configurations on 192.168.122.10(192.168.122.10:3306).. Tue Sep 7 03:00:00 2021 - [info] Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/usr/local/mysql/data --output_file=/tmp/save_binary_logs_test --manager_version=0.57 --start_file=master-bin.000001 Tue Sep 7 03:00:00 2021 - [info] Connecting to root@192.168.122.10(192.168.122.10:22).. Creating /tmp if not exists.. ok. Checking output directory is accessible or not.. ok. Binlog found at /usr/local/mysql/data, up to master-bin.000001 Tue Sep 7 03:00:00 2021 - [info] Binlog setting check done. Tue Sep 7 03:00:00 2021 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers.. Tue Sep 7 03:00:00 2021 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='mha' --slave_host=192.168.122.11 --slave_ip=192.168.122.11 --slave_port=3306 --workdir=/tmp --target_version=5.7.17-log --manager_version=0.57 --relay_log_info=/usr/local/mysql/data/relay-log.info --relay_dir=/usr/local/mysql/data/ --slave_pass=xxx Tue Sep 7 03:00:00 2021 - [info] Connecting to root@192.168.122.11(192.168.122.11:22).. mysqlbinlog: [ERROR] unknown variable 'default-character-set=utf8' mysqlbinlog version command failed with rc 7:0, please verify PATH, LD_LIBRARY_PATH, and client options at /usr/local/bin/apply_diff_relay_logs line 493. Tue Sep 7 03:00:01 2021 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln208] Slaves settings check failed! Tue Sep 7 03:00:01 2021 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln416] Slave configuration failed. Tue Sep 7 03:00:01 2021 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln427] Error happened on checking configurations. at /usr/local/bin/masterha_check_repl line 48. Tue Sep 7 03:00:01 2021 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln525] Error happened on monitoring servers. Tue Sep 7 03:00:01 2021 - [info] Got exit code 1 (Not master dead). MySQL Replication Health is NOT OK!
锁定报错原因为:[ERROR] unknown variable 'default-character-set=utf8'@192.168.122.11
前往192.168.122.11主机(以及同配置的其他slave主机)的/etc/my.cnf删除错误配置并重启mysql服务即可
[root@manager scripts]# masterha_check_repl -conf=/etc/masterha/app1.cnf Tue Sep 7 03:10:16 2021 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping. Tue Sep 7 03:10:16 2021 - [info] Reading application default configuration from /etc/masterha/app1.cnf.. Tue Sep 7 03:10:16 2021 - [info] Reading server configuration from /etc/masterha/app1.cnf.. Tue Sep 7 03:10:16 2021 - [info] MHA::MasterMonitor version 0.57. Tue Sep 7 03:10:17 2021 - [info] GTID failover mode = 0 Tue Sep 7 03:10:17 2021 - [info] Dead Servers: Tue Sep 7 03:10:17 2021 - [info] Alive Servers: Tue Sep 7 03:10:17 2021 - [info] 192.168.122.10(192.168.122.10:3306) Tue Sep 7 03:10:17 2021 - [info] 192.168.122.11(192.168.122.11:3306) Tue Sep 7 03:10:17 2021 - [info] 192.168.122.12(192.168.122.12:3306) Tue Sep 7 03:10:17 2021 - [info] Alive Slaves: Tue Sep 7 03:10:17 2021 - [info] 192.168.122.11(192.168.122.11:3306) Version=5.7.17-log (oldest major version between slaves) log-bin:enabled Tue Sep 7 03:10:17 2021 - [info] Replicating from 192.168.122.10(192.168.122.10:3306) Tue Sep 7 03:10:17 2021 - [info] Primary candidate for the new Master (candidate_master is set) Tue Sep 7 03:10:17 2021 - [info] 192.168.122.12(192.168.122.12:3306) Version=5.7.17-log (oldest major version between slaves) log-bin:enabled Tue Sep 7 03:10:17 2021 - [info] Replicating from 192.168.122.10(192.168.122.10:3306) Tue Sep 7 03:10:17 2021 - [info] Current Alive Master: 192.168.122.10(192.168.122.10:3306) Tue Sep 7 03:10:17 2021 - [info] Checking slave configurations.. Tue Sep 7 03:10:17 2021 - [info] read_only=1 is not set on slave 192.168.122.11(192.168.122.11:3306). Tue Sep 7 03:10:17 2021 - [warning] relay_log_purge=0 is not set on slave 192.168.122.11(192.168.122.11:3306). Tue Sep 7 03:10:17 2021 - [info] read_only=1 is not set on slave 192.168.122.12(192.168.122.12:3306). Tue Sep 7 03:10:17 2021 - [warning] relay_log_purge=0 is not set on slave 192.168.122.12(192.168.122.12:3306). Tue Sep 7 03:10:17 2021 - [info] Checking replication filtering settings.. Tue Sep 7 03:10:17 2021 - [info] binlog_do_db= , binlog_ignore_db= Tue Sep 7 03:10:17 2021 - [info] Replication filtering check ok. Tue Sep 7 03:10:17 2021 - [info] GTID (with auto-pos) is not supported Tue Sep 7 03:10:17 2021 - [info] Starting SSH connection tests.. Tue Sep 7 03:10:20 2021 - [info] All SSH connection tests passed successfully. Tue Sep 7 03:10:20 2021 - [info] Checking MHA Node version.. Tue Sep 7 03:10:20 2021 - [info] Version check ok. Tue Sep 7 03:10:20 2021 - [info] Checking SSH publickey authentication settings on the current master.. Tue Sep 7 03:10:20 2021 - [info] HealthCheck: SSH to 192.168.122.10 is reachable. Tue Sep 7 03:10:20 2021 - [info] Master MHA Node version is 0.57. Tue Sep 7 03:10:20 2021 - [info] Checking recovery script configurations on 192.168.122.10(192.168.122.10:3306).. Tue Sep 7 03:10:20 2021 - [info] Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/usr/local/mysql/data --output_file=/tmp/save_binary_logs_test --manager_version=0.57 --start_file=master-bin.000001 Tue Sep 7 03:10:20 2021 - [info] Connecting to root@192.168.122.10(192.168.122.10:22).. Creating /tmp if not exists.. ok. Checking output directory is accessible or not.. ok. Binlog found at /usr/local/mysql/data, up to master-bin.000001 Tue Sep 7 03:10:20 2021 - [info] Binlog setting check done. Tue Sep 7 03:10:20 2021 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers.. Tue Sep 7 03:10:20 2021 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='mha' --slave_host=192.168.122.11 --slave_ip=192.168.122.11 --slave_port=3306 --workdir=/tmp --target_version=5.7.17-log --manager_version=0.57 --relay_log_info=/usr/local/mysql/data/relay-log.info --relay_dir=/usr/local/mysql/data/ --slave_pass=xxx Tue Sep 7 03:10:20 2021 - [info] Connecting to root@192.168.122.11(192.168.122.11:22).. Checking slave recovery environment settings.. Opening /usr/local/mysql/data/relay-log.info ... ok. Relay log found at /usr/local/mysql/data, up to relay-log-bin.000006 Temporary relay log file is /usr/local/mysql/data/relay-log-bin.000006 Testing mysql connection and privileges..mysql: [Warning] Using a password on the command line interface can be insecure. done. Testing mysqlbinlog output.. done. Cleaning up test file(s).. done. Tue Sep 7 03:10:21 2021 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='mha' --slave_host=192.168.122.12 --slave_ip=192.168.122.12 --slave_port=3306 --workdir=/tmp --target_version=5.7.17-log --manager_version=0.57 --relay_log_info=/usr/local/mysql/data/relay-log.info --relay_dir=/usr/local/mysql/data/ --slave_pass=xxx Tue Sep 7 03:10:21 2021 - [info] Connecting to root@192.168.122.12(192.168.122.12:22).. Checking slave recovery environment settings.. Opening /usr/local/mysql/data/relay-log.info ... ok. Relay log found at /usr/local/mysql/data, up to relay-log-bin.000006 Temporary relay log file is /usr/local/mysql/data/relay-log-bin.000006 Testing mysql connection and privileges..mysql: [Warning] Using a password on the command line interface can be insecure. done. Testing mysqlbinlog output.. done. Cleaning up test file(s).. done. Tue Sep 7 03:10:21 2021 - [info] Slaves settings check done. Tue Sep 7 03:10:21 2021 - [info] 192.168.122.10(192.168.122.10:3306) (current master) +--192.168.122.11(192.168.122.11:3306) +--192.168.122.12(192.168.122.12:3306) Tue Sep 7 03:10:21 2021 - [info] Checking replication health on 192.168.122.11.. Tue Sep 7 03:10:21 2021 - [info] ok. Tue Sep 7 03:10:21 2021 - [info] Checking replication health on 192.168.122.12.. Tue Sep 7 03:10:21 2021 - [info] ok. Tue Sep 7 03:10:21 2021 - [info] Checking master_ip_failover_script status: Tue Sep 7 03:10:21 2021 - [info] /usr/local/bin/master_ip_failover --command=status --ssh_user=root --orig_master_host=192.168.122.10 --orig_master_ip=192.168.122.10 --orig_master_port=3306 IN SCRIPT TEST====/sbin/ifconfig ens33:1 down==/sbin/ifconfig ens33:1 192.168.122.200=== Checking the Status of the script.. OK Tue Sep 7 03:10:21 2021 - [info] OK. Tue Sep 7 03:10:21 2021 - [warning] shutdown_script is not defined. Tue Sep 7 03:10:21 2021 - [info] Got exit code 0 (Not master dead). MySQL Replication Health is OK.