MySQL 高可用 MHA check scripts
admin
2023-04-23 02:42:36
0

介绍几个MHA check 命令,输出如下

[root@MHA bin]# pwd
/usr/local/bin
[root@MHA bin]# ls -l
total 104
-r-xr-xr-x. 1 root root 16367 Sep  7 09:43 apply_diff_relay_logs
-r-xr-xr-x. 1 root root  4807 Sep  7 09:43 filter_mysqlbinlog
-r-xr-xr-x. 1 root root  1995 Sep  7 09:22 masterha_check_repl
-r-xr-xr-x. 1 root root  1779 Sep  7 09:22 masterha_check_ssh
-r-xr-xr-x. 1 root root  1865 Sep  7 09:22 masterha_check_status
-r-xr-xr-x. 1 root root  3201 Sep  7 09:22 masterha_conf_host
-r-xr-xr-x. 1 root root  2517 Sep  7 09:22 masterha_manager
-r-xr-xr-x. 1 root root  2165 Sep  7 09:22 masterha_master_monitor
-r-xr-xr-x. 1 root root  2373 Sep  7 09:22 masterha_master_switch
-r-xr-xr-x. 1 root root  5171 Sep  7 09:22 masterha_secondary_check
-r-xr-xr-x. 1 root root  1739 Sep  7 09:22 masterha_stop
-rwxr-xr-x. 1 root root  4598 Sep  7 14:20 master_ip_failover
-rwxr-xr-x. 1 root root 10101 Sep  7 14:32 master_ip_online_change
-r-xr-xr-x. 1 root root  8261 Sep  7 09:43 purge_relay_logs
-r-xr-xr-x. 1 root root  7525 Sep  7 09:43 save_binary_logs
[root@MHA bin]# masterha_check_ssh --conf=/etc/app1.cnf 
Sun Sep  9 08:27:02 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Sun Sep  9 08:27:02 2018 - [info] Reading application default configuration from /etc/app1.cnf..
Sun Sep  9 08:27:02 2018 - [info] Reading server configuration from /etc/app1.cnf..
Sun Sep  9 08:27:02 2018 - [info] Starting SSH connection tests..
Sun Sep  9 08:27:02 2018 - [debug] 
Sun Sep  9 08:27:02 2018 - [debug]  Connecting via SSH from root@master(192.168.56.101:22) to root@slave1(192.168.56.102:22)..
Sun Sep  9 08:27:02 2018 - [debug]   ok.
Sun Sep  9 08:27:02 2018 - [debug]  Connecting via SSH from root@master(192.168.56.101:22) to root@slave2(192.168.56.103:22)..
Sun Sep  9 08:27:02 2018 - [debug]   ok.
Sun Sep  9 08:27:03 2018 - [debug] 
Sun Sep  9 08:27:02 2018 - [debug]  Connecting via SSH from root@slave1(192.168.56.102:22) to root@master(192.168.56.101:22)..
Sun Sep  9 08:27:03 2018 - [debug]   ok.
Sun Sep  9 08:27:03 2018 - [debug]  Connecting via SSH from root@slave1(192.168.56.102:22) to root@slave2(192.168.56.103:22)..
Sun Sep  9 08:27:03 2018 - [debug]   ok.
Sun Sep  9 08:27:03 2018 - [debug] 
Sun Sep  9 08:27:03 2018 - [debug]  Connecting via SSH from root@slave2(192.168.56.103:22) to root@master(192.168.56.101:22)..
Sun Sep  9 08:27:03 2018 - [debug]   ok.
Sun Sep  9 08:27:03 2018 - [debug]  Connecting via SSH from root@slave2(192.168.56.103:22) to root@slave1(192.168.56.102:22)..
Sun Sep  9 08:27:03 2018 - [debug]   ok.
Sun Sep  9 08:27:03 2018 - [info] All SSH connection tests passed successfully.
[root@MHA bin]# masterha_check_repl --conf=/etc/app1.cnf 
Sun Sep  9 08:27:15 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Sun Sep  9 08:27:15 2018 - [info] Reading application default configuration from /etc/app1.cnf..
Sun Sep  9 08:27:15 2018 - [info] Reading server configuration from /etc/app1.cnf..
Sun Sep  9 08:27:15 2018 - [info] MHA::MasterMonitor version 0.56.
Sun Sep  9 08:27:16 2018 - [info] GTID failover mode = 0
Sun Sep  9 08:27:16 2018 - [info] Dead Servers:
Sun Sep  9 08:27:16 2018 - [info] Alive Servers:
Sun Sep  9 08:27:16 2018 - [info]   master(192.168.56.101:3306)
Sun Sep  9 08:27:16 2018 - [info]   slave1(192.168.56.102:3306)
Sun Sep  9 08:27:16 2018 - [info]   slave2(192.168.56.103:3306)
Sun Sep  9 08:27:16 2018 - [info] Alive Slaves:
Sun Sep  9 08:27:16 2018 - [info]   slave1(192.168.56.102:3306)  Version=10.1.35-MariaDB (oldest major version between slaves) log-bin:enabled
Sun Sep  9 08:27:16 2018 - [info]     Replicating from 192.168.56.101(192.168.56.101:3306)
Sun Sep  9 08:27:16 2018 - [info]   slave2(192.168.56.103:3306)  Version=10.1.35-MariaDB (oldest major version between slaves) log-bin:enabled
Sun Sep  9 08:27:16 2018 - [info]     Replicating from 192.168.56.101(192.168.56.101:3306)
Sun Sep  9 08:27:16 2018 - [info] Current Alive Master: master(192.168.56.101:3306)
Sun Sep  9 08:27:16 2018 - [info] Checking slave configurations..
Sun Sep  9 08:27:16 2018 - [info] Checking replication filtering settings..
Sun Sep  9 08:27:16 2018 - [info]  binlog_do_db= , binlog_ignore_db= 
Sun Sep  9 08:27:16 2018 - [info]  Replication filtering check ok.
Sun Sep  9 08:27:16 2018 - [info] GTID (with auto-pos) is not supported
Sun Sep  9 08:27:16 2018 - [info] Starting SSH connection tests..
Sun Sep  9 08:27:17 2018 - [info] All SSH connection tests passed successfully.
Sun Sep  9 08:27:17 2018 - [info] Checking MHA Node version..
Sun Sep  9 08:27:18 2018 - [info]  Version check ok.
Sun Sep  9 08:27:18 2018 - [info] Checking SSH publickey authentication settings on the current master..
Sun Sep  9 08:27:18 2018 - [info] HealthCheck: SSH to master is reachable.
Sun Sep  9 08:27:18 2018 - [info] Master MHA Node version is 0.56.
Sun Sep  9 08:27:18 2018 - [info] Checking recovery script configurations on master(192.168.56.101:3306)..
Sun Sep  9 08:27:18 2018 - [info]   Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/data/binlogs --output_file=/var/log/masterha//save_binary_logs_test --manager_version=0.56 --start_file=mysql-bin.000005 
Sun Sep  9 08:27:18 2018 - [info]   Connecting to root@192.168.56.101(master:22).. 
  Creating /var/log/masterha if not exists..    ok.
  Checking output directory is accessible or not..
   ok.
  Binlog found at /data/binlogs, up to mysql-bin.000005
Sun Sep  9 08:27:19 2018 - [info] Binlog setting check done.
Sun Sep  9 08:27:19 2018 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Sun Sep  9 08:27:19 2018 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='admin' --slave_host=slave1 --slave_ip=192.168.56.102 --slave_port=3306 --workdir=/var/log/masterha/ --target_version=10.1.35-MariaDB --manager_version=0.56 --relay_log_info=/data/mysql/relay-log.info  --relay_dir=/data/mysql/  --slave_pass=xxx
Sun Sep  9 08:27:19 2018 - [info]   Connecting to root@192.168.56.102(slave1:22).. 
  Checking slave recovery environment settings..
    Opening /data/mysql/relay-log.info ... ok.
    Relay log found at /data/relaylogs, up to relay-bin.000015
    Temporary relay log file is /data/relaylogs/relay-bin.000015
    Testing mysql connection and privileges.. done.
    Testing mysqlbinlog output.. done.
    Cleaning up test file(s).. done.
Sun Sep  9 08:27:19 2018 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='admin' --slave_host=slave2 --slave_ip=192.168.56.103 --slave_port=3306 --workdir=/var/log/masterha/ --target_version=10.1.35-MariaDB --manager_version=0.56 --relay_log_info=/data/mysql/relay-log.info  --relay_dir=/data/mysql/  --slave_pass=xxx
Sun Sep  9 08:27:19 2018 - [info]   Connecting to root@192.168.56.103(slave2:22).. 
  Checking slave recovery environment settings..
    Opening /data/mysql/relay-log.info ... ok.
    Relay log found at /data/relaylogs, up to relay-bin.000015
    Temporary relay log file is /data/relaylogs/relay-bin.000015
    Testing mysql connection and privileges.. done.
    Testing mysqlbinlog output.. done.
    Cleaning up test file(s).. done.
Sun Sep  9 08:27:19 2018 - [info] Slaves settings check done.
Sun Sep  9 08:27:19 2018 - [info] 
master(192.168.56.101:3306) (current master)
 +--slave1(192.168.56.102:3306)
 +--slave2(192.168.56.103:3306)

Sun Sep  9 08:27:19 2018 - [info] Checking replication health on slave1..
Sun Sep  9 08:27:19 2018 - [info]  ok.
Sun Sep  9 08:27:19 2018 - [info] Checking replication health on slave2..
Sun Sep  9 08:27:19 2018 - [info]  ok.
Sun Sep  9 08:27:19 2018 - [info] Checking master_ip_failover_script status:
Sun Sep  9 08:27:19 2018 - [info]   /usr/local/bin/master_ip_failover --command=status --ssh_user=root --orig_master_host=master --orig_master_ip=192.168.56.101 --orig_master_port=3306 
    inet 192.168.56.105/32 scope global eth2
INFO: VIP 192.168.1.100 found on Master
Sun Sep  9 08:27:19 2018 - [info]  OK.
Sun Sep  9 08:27:19 2018 - [warning] shutdown_script is not defined.
Sun Sep  9 08:27:19 2018 - [info] Got exit code 0 (Not master dead).

MySQL Replication Health is OK.
[root@MHA bin]# 
[root@MHA bin]# masterha_check_s
masterha_check_ssh     masterha_check_status  
[root@MHA bin]# masterha_check_status --conf=/etc/app1.cnf 
app1 is stopped(2:NOT_RUNNING).
[root@MHA bin]# masterha_check_status 
Either --conf or --status_dir must be set.
 at /usr/local/share/perl5/MHA/ManagerAdminWrapper.pm line 121
[root@MHA bin]# 

相关内容

热门资讯

“一次愉快的会晤”,泽连斯基披... 在俄乌互相加大对对方纵深目标打击之际,乌克兰总统泽连斯基7月28日造访了白宫,与美国总统特朗普举行会...
总统连遭“逼宫”,少帅临危受命 躲避着燃烧瓶和火箭弹袭击,四辆苏制BMP步兵战车快速穿行在马里乌波尔市区。即将出城的路口,迎面出现1...
独居女子在卧室玩偶内发现摄像头... 租房独居女子意外发现家中玩偶内藏着偷拍设备,报警后偷拍设备竟“不翼而飞”,门锁记录显示有人在她出门的...
伊学者:乌克兰袭击行动适得其反... 乌克兰袭击与伊朗有关的船只后,伊朗和俄罗斯接连作出强硬回应。伊朗外交学院教授法拉吉扎德在接受凤凰卫视...
20万人怒火不会停!蓝议员挺蒋... 海峡导报综合报道 在蓝白号召台湾民众上凯道呐喊“反毒台”后,台北市长蒋万安日前透露,近日不少民代私下...
柯文哲妻子陈佩琪畅游大陆,民进... 台湾民众党前主席柯文哲妻子陈佩琪27日在脸书发文证实,自己早前由儿子陪同前往上海、杭州与北京旅游一周...
高市早苗被问如何改善中日关系 据日本东京新闻报道,当地时间7月27日,日本首相高市早苗在首相官邸举行记者会。当被问及如何改善中日关...
扎哈罗娃批小泉进次郎涉核言论:... 【环球网报道 记者 张江平】综合俄新社等媒体报道,对于日本防卫大臣小泉进次郎涉核言论,俄罗斯外交部发...
“特高课”再现?日本强推“国家... 无视反对战争正义呼声 复刻战前军国主义体制日本强推“国家情报局”引发广泛担忧和批评(国际视点)本报记...
6G相比5G不只是速度更快 将...   6G相比5G不只是速度更快  【6G相比5G不只是速度更快】7月28日,相比5G,6G不仅是速度...