MHA masterha_check_repl detection process, gocheck paper detection

Source: Internet
Author: User

MHA masterha_check_repl detection process, gocheck paper detection

Whether the MHA deployment and configuration are OK. We can use the masterha_check_ssh and masterha_check_repl scripts provided by MHA to check whether the MHA deployment and configuration are OK. Masterha_check_repl detection is an important step to ensure successful MHA switching. This article mainly describes what the masterha_check_repl detection script has done. This helps you better understand the MHA principles and processes.

 

1. Current master-slave Environment
[Root @ vdbsrv1 ~] # More/etc/hosts
127.0.0.1 localhost. localdomain localhost
192.168.1.6 vdbsrv1 # master
192.168.1.7 vdbsrv2 # slave1
192.168.1.8 vdbsrv3 # slave2
192.168.1.12 vdbsrv4 # manager

### OS environment
[Root @ vdbsrv4 ~] # More/etc/issue
CentOS release 5.9 (Final)
Kernel \ r on an \ m

### Mysql Environment
[Root @ vdbsrv4 ~] # Mysql-e "show variables like 'version '"
+ --------------- + ------------ +
| Variable_name | Value |
+ --------------- + ------------ +
| Version | 5.6.22-log |
+ --------------- + ------------ +

[Root @ vdbsrv4 ~] # Masterha_manager -- version
Masterha_manager version 0.56.

 

2. Current MHA configuration information
[Root @ vdbsrv4 ~] $ More/etc/masterha/app1.cnf
[Server default]
Manager_workdir =/var/log/masterha/app1
Manager_log =/var/log/masterha/app1/manager. log

User = mha
Password = xxx
Ssh_user = root
Repl_user = repl
Repl_password = repl
Ping_interval = 1
Shutdown_script = ""
Master_ip_online_change_script = ""
Report_script = ""
Master_ip_failover_script =/tmp/master_ip_failover

[Server1]
Hostname = vdbsrv1
Master_binlog_dir =/data/mysqldata

[Server2]
Hostname = vdbsrv2
Master_binlog_dir =/data/mysqldata

[Server3]
Hostname = vdbsrv3
Master_binlog_dir =/data/mysqldata/
# Candidate_master = 1

 

3. masterha_check_repl detection steps
A. Read the configuration file
B. Check the mysql server listed in the configuration file (identify the master and slave nodes)
C. Check slave database configuration information
Read_only Parameter
Relay_log_purge Parameter
Copy filter rules
D. Verify the equivalence of ssh
E. Check whether the binlog script (save_binary_logs) is saved in the master database. It is mainly used to read logs from the binlog when the master database dies.
F. Check whether binlog (apply_diff_relay_logs) of different slave databases can be applied)
G. Check IP address switching. If there is a deployment script

 

4. Actual detection process
[Root @ vdbsrv4 ~] # Masterha_check_repl -- conf =/etc/masterha/app1.cnf
Fri Apr 17 18:48:41 2015-[warning] Global configuration file/etc/masterha_default.cnf not found. Skipping.
Fri Apr 17 18:48:41 2015-[info] Reading application default configuration from/etc/masterha/app1.cnf ..
Fri Apr 17 18:48:41 2015-[info] Reading server configuration from/etc/masterha/app1.cnf .. ### read the configuration file
Fri Apr 17 18:48:41 2015-[info] MHA: MasterMonitor version 0.56.
Fri Apr 17 18:48:42 2015-[info] GTID failover mode = 0
Fri Apr 17 18:48:42 2015-[info] Dead Servers: ### start to detect mysql Servers listed in the configuration file (Master/Slave identification)
Fri Apr 17 18:48:42 2015-[info] Alive Servers:
Fri Apr 17 18:48:42 2015-[info] vdbsrv1 (192.168.1.6: 3306)
Fri Apr 17 18:48:42 2015-[info] vdbsrv2 (192.168.1.7: 3306)
Fri Apr 17 18:48:42 2015-[info] vdbsrv3 (192.168.1.8: 3306)
Fri Apr 17 18:48:42 2015-[info] Alive Slaves:
Fri Apr 17 18:48:42 2015-[info] vdbsrv2 (192.168.1.7: 3306) Version = 5.6.22-log (oldest major version between slaves) log-bin: enabled
Fri Apr 17 18:48:42 2015-[info] Replicating from 192.168.1.6 (192.168.1.6: 3306)
Fri Apr 17 18:48:42 2015-[info] vdbsrv3 (192.168.1.8: 3306) Version = 5.6.22-log (oldest major version between slaves) log-bin: enabled
Fri Apr 17 18:48:42 2015-[info] Replicating from 192.168.1.6 (192.168.1.6: 3306)
Fri Apr 17 18:48:42 2015-[info] Current Alive Master: vdbsrv1 (192.168.1.6: 3306)
Fri Apr 17 18:48:42 2015-[info] Checking slave events... ### check slave database configuration information
Fri Apr 17 18:48:42 2015-[info] read_only = 1 is not set on slave vdbsrv2 (192.168.1.7: 3306 ).
Fri Apr 17 18:48:42 2015-[warning] relay_log_purge = 0 is not set on slave vdbsrv2 (192.168.1.7: 3306 ).
Fri Apr 17 18:48:42 2015-[info] read_only = 1 is not set on slave vdbsrv3 (192.168.1.8: 3306 ).
Fri Apr 17 18:48:42 2015-[warning] relay_log_purge = 0 is not set on slave vdbsrv3 (192.168.1.8: 3306 ).
Fri Apr 17 18:48:42 2015-[info] Checking replication filtering settings... ### check replication filter rules
Fri Apr 17 18:48:42 2015-[info] binlog_do_db =, binlog_ignore_db =
Fri Apr 17 18:48:42 2015-[info] Replication filtering check OK.
Fri Apr 17 18:48:42 2015-[info] GTID (with auto-pos) is not supported
Fri Apr 17 18:48:42 2015-[info] Starting SSH connection tests... ### ssh equivalence Verification
Fri Apr 17 18:48:43 2015-[info] All SSH connection tests passed successfully.
Fri Apr 17 18:48:43 2015-[info] Checking MHA Node version ..
Fri Apr 17 18:48:44 2015-[info] Version check OK.
Fri Apr 17 18:48:44 2015-[info] Checking SSH publickey authentication settings on the current master ..
Fri Apr 17 18:48:44 2015-[info] HealthCheck: SSH to vdbsrv1 is reachable.
Fri Apr 17 18:48:44 2015-[info] Master MHA Node version is 0.56.
Fri Apr 17 18:48:44 2015-[info] Checking recovery script deployments on vdbsrv1 (192.168.1.6: 3306)... ### check whether the binlog script is saved in the master database
Fri Apr 17 18:48:44 2015-[info] Executing command: save_binary_logs -- command = test -- start_pos = 4 -- binlog_dir =/data/mysqldata
-- Output_file =/var/tmp/save_binary_logs_test -- manager_version = 0.56 -- start_file = mysql-bin.000012
Fri Apr 17 18:48:44 2015-[info] Connecting to root@192.168.1.6 (vdbsrv1: 22 )..
Creating/var/tmp if not exists... OK.
Checking output directory is accessible or not ..
OK.
Binlog found at/data/mysqldata, up to mysql-bin.000012
Fri Apr 17 18:48:44 2015-[info] Binlog setting check done. ### check whether the slave database can apply bad binary logs
Fri Apr 17 18:48:44 2015-[info] Checking SSH publickey authentication and checking recovery script deployments on all alive slave servers ..
Fri Apr 17 18:48:44 2015-[info] Executing command: apply_diff_relay_logs -- command = test -- slave_user = 'mha '-- slave_host = vdbsrv2
-- Slave_ip = 192.168.1.7 -- slave_port = 3306 -- workdir =/var/tmp -- target_version = 5.6.22-log -- manager_version = 0.56
-- Relay_log_info =/data/mysqldata/relay-log.info -- relay_dir =/data/mysqldata/-- slave_pass = xxx
Fri Apr 17 18:48:44 2015-[info] Connecting to root@192.168.1.7 (vdbsrv2: 22 )..
Checking slave recovery environment settings ..
Opening/data/mysqldata/relay-log.info... OK.
Relay log found at/data/mysqldata, up to vdbsrv2-relay-bin.000006
Temporary relay log file is/data/mysqldata/vdbsrv2-relay-bin.000006
Testing mysql connection and privileges... done .. # Author: Leshami
Testing mysqlbinlog output... done .. # Blog: http://blog.csdn.net/leshami
Cleaning up test file (s)... done.
Fri Apr 17 18:48:44 2015-[info] Executing command: apply_diff_relay_logs -- command = test -- slave_user = 'mha '-- slave_host = vdbsrv3
-- Slave_ip = 192.168.1.8 -- slave_port = 3306 -- workdir =/var/tmp -- target_version = 5.6.22-log -- manager_version = 0.56
-- Relay_log_info =/data/mysqldata/relay-log.info -- relay_dir =/data/mysqldata/-- slave_pass = xxx
Fri Apr 17 18:48:44 2015-[info] Connecting to root@192.168.1.8 (vdbsrv3: 22 )..
Checking slave recovery environment settings ..
Opening/data/mysqldata/relay-log.info... OK.
Relay log found at/data/mysqldata, up to vdbsrv3-relay-bin.000006
Temporary relay log file is/data/mysqldata/vdbsrv3-relay-bin.000006
Testing mysql connection and privileges... done.
Testing mysqlbinlog output... done.
Cleaning up test file (s)... done.
Fri Apr 17 18:48:45 2015-[info] Slaves settings check done.
Fri Apr 17 18:48:45 2015-[info]
Vdbsrv1 (192.168.1.6: 3306) (current master)
+ -- Vdbsrv2 (192.168.1.7: 3306)
+ -- Vdbsrv3 (192.168.1.8: 3306)

Fri Apr 17 18:48:45 2015-[info] Checking replication health on vdbsrv2 ..
Fri Apr 17 18:48:45 2015-[info] OK.
Fri Apr 17 18:48:45 2015-[info] Checking replication health on vdbsrv3 ..
Fri Apr 17 18:48:45 2015-[info] OK.
Fri Apr 17 18:48:45 2015-[info] Checking master_ip_failover_script status: ### check IP address Switching
Fri Apr 17 18:48:45 2015-[info]/tmp/master_ip_failover -- command = status -- ssh_user = root -- orig_master_host = vdbsrv1
-- Orig_master_ip = 192.168.1.6 -- orig_master_port = 3306

In script test ===/ sbin/ifconfig eth0: 0 down ==/ sbin/ifconfig eth0: 0 192.168.1.13/24 ====

Checking the Status of the script... OK
Fri Apr 17 18:48:45 2015-[info] OK.
Fri Apr 17 18:48:45 2015-[warning] shutdown_script is not defined.
Fri Apr 17 18:48:45 2015-[info] Got exit code 0 (Not master dead ).

MySQL Replication Health is OK.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.