MHA测试 mysql 主从连接情况masterha_check_repl -conf=/etc/masterha/app1.cnf报错

报错1:Value "3306  " invalid for option slave_port (number expected)

[root@mysql2 masterha]# masterha_check_repl -conf=/etc/masterha/app1.cnf
Thu Sep 23 00:09:12 2021 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='mha' --slave_host=192.168.229.70 --slave_ip=192.168.229.70 --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
Thu Sep 23 00:09:12 2021 - [info]   Connecting to root@192.168.229.70(192.168.229.70:22).. 
Usage:
    # For checking apply_diff_relay_logs --command=test
    --target_version=5.1.56 --relay_log_info=s --slave_user=s --slave_host=s
    --slave_ip=s --slave_port=i --workdir=s

    # For generating differential log events apply_diff_relay_logs
    --command=generate_and_send --target_version=5.1.56 --scp_user=s
    --scp_host=s --latest_mlf=s --target_mlf=s --target_rmlp=i
    --relay_log_info=s --server_id=i --diff_file_readtolatest=s
    --target_version=s --workdir=s --timestamp=s

    # For applying log files apply_diff_relay_logs --command=apply
    --target_version=5.1.56 --slave_user=s --slave_host=s --slave_ip=s
    --slave_port=i --apply_files=file1,file2.. --workdir=s --timestamp=s
    --slave_pass=xxx

Value "3306  " invalid for option slave_port (number expected)
Thu Sep 23 00:09:12 2021 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln208] Slaves settings check failed!
Thu Sep 23 00:09:12 2021 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln416] Slave configuration failed.
Thu Sep 23 00:09:12 2021 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln427] Error happened on checking configurations.  at /usr/local/bin/masterha_check_repl line 48.
Thu Sep 23 00:09:12 2021 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln525] Error happened on monitoring servers.
Thu Sep 23 00:09:12 2021 - [info] Got exit code 1 (Not master dead).

MySQL Replication Health is NOT OK!

MHA测试 mysql 主从连接情况masterha_check_repl -conf=/etc/masterha/app1.cnf报错

解决:查找原因,配置文件中含有port 3306的(多了空格)

MHA测试 mysql 主从连接情况masterha_check_repl -conf=/etc/masterha/app1.cnf报错

MHA测试 mysql 主从连接情况masterha_check_repl -conf=/etc/masterha/app1.cnf报错

 报错2:Failed to get master_ip_failover_script status with return code 2:0.

[root@mysql2 masterha]# masterha_check_repl -conf=/etc/masterha/app1.cnf
Thu Sep 23 00:17:38 2021 - [info]   /usr/local/bin/master_ip_failover --command=status --ssh_user=root --orig_master_host=192.168.229.90 --orig_master_ip=192.168.229.90 --orig_master_port=3306 
/usr/local/bin/master_ip_failover:行3: use: 未找到命令
/usr/local/bin/master_ip_failover:行4: use: 未找到命令
/usr/local/bin/master_ip_failover:行6: use: 未找到命令
/usr/local/bin/master_ip_failover:行8: 未预期的符号 `newline' 附近有语法错误
/usr/local/bin/master_ip_failover:行8: ` my ('
Thu Sep 23 00:17:38 2021 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln229]  Failed to get master_ip_failover_script status with return code 2:0.
Thu Sep 23 00:17:38 2021 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln427] Error happened on checking configurations.  at /usr/local/bin/masterha_check_repl line 48.
Thu Sep 23 00:17:38 2021 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln525] Error happened on monitoring servers.
Thu Sep 23 00:17:38 2021 - [info] Got exit code 1 (Not master dead).

MySQL Replication Health is NOT OK!

解决:

查找原因:此配置文件有问题

最终发现,

MHA测试 mysql 主从连接情况masterha_check_repl -conf=/etc/masterha/app1.cnf报错

修改之后:

检测成功

[root@mysql2 masterha]# masterha_check_repl -conf=/etc/masterha/app1.cnf
Thu Sep 23 00:34:18 2021 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Thu Sep 23 00:34:18 2021 - [info] Reading application default configuration from /etc/masterha/app1.cnf..
Thu Sep 23 00:34:18 2021 - [info] Reading server configuration from /etc/masterha/app1.cnf..
Thu Sep 23 00:34:18 2021 - [info] MHA::MasterMonitor version 0.57.
Thu Sep 23 00:34:20 2021 - [info] GTID failover mode = 0
Thu Sep 23 00:34:20 2021 - [info] Dead Servers:
Thu Sep 23 00:34:20 2021 - [info] Alive Servers:
Thu Sep 23 00:34:20 2021 - [info]   192.168.229.90(192.168.229.90:3306)
Thu Sep 23 00:34:20 2021 - [info]   192.168.229.80(192.168.229.80:3306)
Thu Sep 23 00:34:20 2021 - [info]   192.168.229.70(192.168.229.70:3306)
Thu Sep 23 00:34:20 2021 - [info] Alive Slaves:
Thu Sep 23 00:34:20 2021 - [info]   192.168.229.80(192.168.229.80:3306)  Version=5.7.17-log (oldest major version between slaves) log-bin:enabled
Thu Sep 23 00:34:20 2021 - [info]     Replicating from 192.168.229.90(192.168.229.90:3306)
Thu Sep 23 00:34:20 2021 - [info]     Primary candidate for the new Master (candidate_master is set)
Thu Sep 23 00:34:20 2021 - [info]   192.168.229.70(192.168.229.70:3306)  Version=5.7.17-log (oldest major version between slaves) log-bin:enabled
Thu Sep 23 00:34:20 2021 - [info]     Replicating from 192.168.229.90(192.168.229.90:3306)
Thu Sep 23 00:34:20 2021 - [info] Current Alive Master: 192.168.229.90(192.168.229.90:3306)
Thu Sep 23 00:34:20 2021 - [info] Checking slave configurations..
Thu Sep 23 00:34:20 2021 - [info]  read_only=1 is not set on slave 192.168.229.80(192.168.229.80:3306).
Thu Sep 23 00:34:20 2021 - [warning]  relay_log_purge=0 is not set on slave 192.168.229.80(192.168.229.80:3306).
Thu Sep 23 00:34:20 2021 - [info]  read_only=1 is not set on slave 192.168.229.70(192.168.229.70:3306).
Thu Sep 23 00:34:20 2021 - [warning]  relay_log_purge=0 is not set on slave 192.168.229.70(192.168.229.70:3306).
Thu Sep 23 00:34:20 2021 - [info] Checking replication filtering settings..
Thu Sep 23 00:34:20 2021 - [info]  binlog_do_db= , binlog_ignore_db= 
Thu Sep 23 00:34:20 2021 - [info]  Replication filtering check ok.
Thu Sep 23 00:34:20 2021 - [info] GTID (with auto-pos) is not supported
Thu Sep 23 00:34:20 2021 - [info] Starting SSH connection tests..
Thu Sep 23 00:34:22 2021 - [info] All SSH connection tests passed successfully.
Thu Sep 23 00:34:22 2021 - [info] Checking MHA Node version..
Thu Sep 23 00:34:22 2021 - [info]  Version check ok.
Thu Sep 23 00:34:22 2021 - [info] Checking SSH publickey authentication settings on the current master..
Thu Sep 23 00:34:23 2021 - [info] HealthCheck: SSH to 192.168.229.90 is reachable.
Thu Sep 23 00:34:23 2021 - [info] Master MHA Node version is 0.57.
Thu Sep 23 00:34:23 2021 - [info] Checking recovery script configurations on 192.168.229.90(192.168.229.90:3306)..
Thu Sep 23 00:34:23 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.000006 
Thu Sep 23 00:34:23 2021 - [info]   Connecting to root@192.168.229.90(192.168.229.90: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.000006
Thu Sep 23 00:34:23 2021 - [info] Binlog setting check done.
Thu Sep 23 00:34:23 2021 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Thu Sep 23 00:34:23 2021 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='mha' --slave_host=192.168.229.80 --slave_ip=192.168.229.80 --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
Thu Sep 23 00:34:23 2021 - [info]   Connecting to root@192.168.229.80(192.168.229.80: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.000017
    Temporary relay log file is /usr/local/mysql/data/relay-log-bin.000017
    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.
Thu Sep 23 00:34:23 2021 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='mha' --slave_host=192.168.229.70 --slave_ip=192.168.229.70 --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
Thu Sep 23 00:34:23 2021 - [info]   Connecting to root@192.168.229.70(192.168.229.70: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.
Thu Sep 23 00:34:23 2021 - [info] Slaves settings check done.
Thu Sep 23 00:34:23 2021 - [info] 
192.168.229.90(192.168.229.90:3306) (current master)
 +--192.168.229.80(192.168.229.80:3306)
 +--192.168.229.70(192.168.229.70:3306)

Thu Sep 23 00:34:23 2021 - [info] Checking replication health on 192.168.229.80..
Thu Sep 23 00:34:23 2021 - [info]  ok.
Thu Sep 23 00:34:23 2021 - [info] Checking replication health on 192.168.229.70..
Thu Sep 23 00:34:23 2021 - [info]  ok.
Thu Sep 23 00:34:23 2021 - [info] Checking master_ip_failover_script status:
Thu Sep 23 00:34:23 2021 - [info]   /usr/local/bin/master_ip_failover --command=status --ssh_user=root --orig_master_host=192.168.229.90 --orig_master_ip=192.168.229.90 --orig_master_port=3306 


IN SCRIPT TEST====/sbin/ifconfig ens33:1 down==/sbin/ifconfig ens33:1 192.168.229.188===

Checking the Status of the script.. OK 
Thu Sep 23 00:34:23 2021 - [info]  OK.
Thu Sep 23 00:34:23 2021 - [warning] shutdown_script is not defined.
Thu Sep 23 00:34:23 2021 - [info] Got exit code 0 (Not master dead).

MySQL Replication Health is OK.

 

上一篇:Photoshop教程:制作有趣的小鸟动画


下一篇:基于 Redis 存储 Session