MHA(Master High Availability Manager and tools for MySQL)目前在MySQL高可用方面是一个相对成熟的解决方案,它是由日本人youshimaton采用Perl语言编写的一个脚本管理工具。MHA是一套优秀的作为MySQL高可用性环境下故障切换和主从提升的高可用软件。MHA仅适用于MySQL Replication环境,目的在于维持Master主库的高可用性。在MySQL故障切换过程中,MHA能做到0~30秒之内自动完成数据库的故障切换操作,并且在进行故障切换的过程中,MHA能最大程度上保证数据库的一致性,以达到真正意义上的高可用。
1C:\Users\lhrxxt>mysql -h192.168.59.220 -uroot -plhr -P33062 2mysql: [Warning] Using a password on the command line interface can be insecure. 3Welcome to the MySQL monitor. Commands endwith ; or \g. 4Your MySQL connection id is 2 5Server version: 5.7.30-log MySQL Community Server (GPL) 6 7Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. 8 9Oracle is a registered trademark of Oracle Corporation and/or its 10affiliates. Other names may be trademarks of their respective 11owners. 12 13Type 'help;' or '\h' for help. Type'\c'toclear the currentinput statement. 14 15MySQL [(none)]> startslave; 16ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository 17 18MySQL [(none)]> resetslave; 19Query OK, 0 rows affected (0.02 sec) 20 21MySQL [(none)]> startslave; 22Query OK, 0 rows affected (0.01 sec) 23 24MySQL [(none)]> showslavestatus \G 25*************************** 1.row *************************** 26 Slave_IO_State: Waiting formasterto send event 27 Master_Host: 192.168.68.131 28 Master_User: repl 29 Master_Port: 3306 30 Connect_Retry: 60 31 Master_Log_File: MHA-LHR-Master1-ip131-bin.000011 32 Read_Master_Log_Pos: 234 33 Relay_Log_File: MHA-LHR-Master1-ip131-relay-bin.000003 34 Relay_Log_Pos: 399 35 Relay_Master_Log_File: MHA-LHR-Master1-ip131-bin.000011 36 Slave_IO_Running: Yes 37 Slave_SQL_Running: Yes 38 Replicate_Do_DB: 39 Replicate_Ignore_DB: information_schema,performance_schema,mysql,sys 40 Replicate_Do_Table: 41 Replicate_Ignore_Table: 42 Replicate_Wild_Do_Table: 43 Replicate_Wild_Ignore_Table: 44 Last_Errno: 0 45 Last_Error: 46 Skip_Counter: 0 47 Exec_Master_Log_Pos: 234 48 Relay_Log_Space: 799 49 Until_Condition: None 50 Until_Log_File: 51 Until_Log_Pos: 0 52 Master_SSL_Allowed: No 53 Master_SSL_CA_File: 54 Master_SSL_CA_Path: 55 Master_SSL_Cert: 56 Master_SSL_Cipher: 57 Master_SSL_Key: 58 Seconds_Behind_Master: 0 59Master_SSL_Verify_Server_Cert: No 60 Last_IO_Errno: 0 61 Last_IO_Error: 62 Last_SQL_Errno: 0 63 Last_SQL_Error: 64 Replicate_Ignore_Server_Ids: 65 Master_Server_Id: 573306131 66 Master_UUID: c8ca4f1d-aec3-11ea-942b-0242c0a84483 67 Master_Info_File: /usr/local/mysql-5.7.30-linux-glibc2.12-x86_64/data/master.info 68 SQL_Delay: 0 69 SQL_Remaining_Delay: NULL 70 Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates 71 Master_Retry_Count: 86400 72 Master_Bind: 73 Last_IO_Error_Timestamp: 74 Last_SQL_Error_Timestamp: 75 Master_SSL_Crl: 76 Master_SSL_Crlpath: 77 Retrieved_Gtid_Set: 78 Executed_Gtid_Set: c8ca4f1d-aec3-11ea-942b-0242c0a84483:1-11, 79d24a77d1-aec3-11ea-9399-0242c0a84484:1-3 80 Auto_Position: 1 81 Replicate_Rewrite_DB: 82 Channel_Name: 83 Master_TLS_Version: 841 row in set (0.00 sec)
至此,我们就把MHA环境准备好了,接下来就开始测试MHA的各项功能。
三、测试MHA相关功能
在正式测试之前,我们要保证MHA环境已经配置正确,且MHA管理进程已经启动。
3.1 检查MHA环境的配置
在Manager节点检查SSH、复制及MHA的状态。
3.1.1 检查SSH情况:
1[root@MHA-LHR-Monitor-ip134 /]# masterha_check_ssh --conf=/etc/mha/mha.cnf 2Sat Aug 8 09:57:42 2020 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping. 3Sat Aug 8 09:57:42 2020 - [info] Reading application default configuration from /etc/mha/mha.cnf.. 4Sat Aug 8 09:57:42 2020 - [info] Reading server configuration from /etc/mha/mha.cnf.. 5Sat Aug 8 09:57:42 2020 - [info] Starting SSH connection tests.. 6Sat Aug 8 09:57:43 2020 - [debug] 7Sat Aug 8 09:57:42 2020 - [debug] Connecting via SSH from root@192.168.68.131(192.168.68.131:22) to root@192.168.68.132(192.168.68.132:22).. 8Sat Aug 8 09:57:42 2020 - [debug] ok. 9Sat Aug 8 09:57:42 2020 - [debug] Connecting via SSH from root@192.168.68.131(192.168.68.131:22) to root@192.168.68.133(192.168.68.133:22).. 10Sat Aug 8 09:57:42 2020 - [debug] ok. 11Sat Aug 8 09:57:43 2020 - [debug] 12Sat Aug 8 09:57:42 2020 - [debug] Connecting via SSH from root@192.168.68.132(192.168.68.132:22) to root@192.168.68.131(192.168.68.131:22).. 13Sat Aug 8 09:57:42 2020 - [debug] ok. 14Sat Aug 8 09:57:42 2020 - [debug] Connecting via SSH from root@192.168.68.132(192.168.68.132:22) to root@192.168.68.133(192.168.68.133:22).. 15Sat Aug 8 09:57:43 2020 - [debug] ok. 16Sat Aug 8 09:57:44 2020 - [debug] 17Sat Aug 8 09:57:43 2020 - [debug] Connecting via SSH from root@192.168.68.133(192.168.68.133:22) to root@192.168.68.131(192.168.68.131:22).. 18Sat Aug 8 09:57:43 2020 - [debug] ok. 19Sat Aug 8 09:57:43 2020 - [debug] Connecting via SSH from root@192.168.68.133(192.168.68.133:22) to root@192.168.68.132(192.168.68.132:22).. 20Sat Aug 8 09:57:43 2020 - [debug] ok. 21Sat Aug 8 09:57:44 2020 - [info] All SSH connection tests passed successfully.
1[root@MHA-LHR-Monitor-ip134 /]# masterha_check_repl --conf=/etc/mha/mha.cnf 2Sat Aug 8 09:59:31 2020 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping. 3Sat Aug 8 09:59:31 2020 - [info] Reading application default configuration from /etc/mha/mha.cnf.. 4Sat Aug 8 09:59:31 2020 - [info] Reading server configuration from /etc/mha/mha.cnf.. 5Sat Aug 8 09:59:31 2020 - [info] MHA::MasterMonitor version 0.58. 6Sat Aug 8 09:59:33 2020 - [info] GTID failover mode = 1 7Sat Aug 8 09:59:33 2020 - [info] Dead Servers: 8Sat Aug 8 09:59:33 2020 - [info] Alive Servers: 9Sat Aug 8 09:59:33 2020 - [info] 192.168.68.131(192.168.68.131:3306) 10Sat Aug 8 09:59:33 2020 - [info] 192.168.68.132(192.168.68.132:3306) 11Sat Aug 8 09:59:33 2020 - [info] 192.168.68.133(192.168.68.133:3306) 12Sat Aug 8 09:59:33 2020 - [info] Alive Slaves: 13Sat Aug 8 09:59:33 2020 - [info] 192.168.68.132(192.168.68.132:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 14Sat Aug 8 09:59:33 2020 - [info] GTID ON 15Sat Aug 8 09:59:33 2020 - [info] Replicating from 192.168.68.131(192.168.68.131:3306) 16Sat Aug 8 09:59:33 2020 - [info] Primary candidate for the new Master (candidate_master is set) 17Sat Aug 8 09:59:33 2020 - [info] 192.168.68.133(192.168.68.133:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 18Sat Aug 8 09:59:33 2020 - [info] GTID ON 19Sat Aug 8 09:59:33 2020 - [info] Replicating from 192.168.68.131(192.168.68.131:3306) 20Sat Aug 8 09:59:33 2020 - [info] Current Alive Master: 192.168.68.131(192.168.68.131:3306) 21Sat Aug 8 09:59:33 2020 - [info] Checking slave configurations.. 22Sat Aug 8 09:59:33 2020 - [info] read_only=1 is not set on slave 192.168.68.132(192.168.68.132:3306). 23Sat Aug 8 09:59:33 2020 - [info] read_only=1 is not set on slave 192.168.68.133(192.168.68.133:3306). 24Sat Aug 8 09:59:33 2020 - [info] Checking replication filtering settings.. 25Sat Aug 8 09:59:33 2020 - [info] binlog_do_db= , binlog_ignore_db= information_schema,mysql,performance_schema,sys 26Sat Aug 8 09:59:33 2020 - [info] Replication filtering check ok. 27Sat Aug 8 09:59:33 2020 - [info] GTID (with auto-pos) is supported. Skipping all SSH and Node package checking. 28Sat Aug 8 09:59:33 2020 - [info] Checking SSH publickey authentication settings on the current master.. 29Sat Aug 8 09:59:33 2020 - [info] HealthCheck: SSH to 192.168.68.131 is reachable. 30Sat Aug 8 09:59:33 2020 - [info] 31192.168.68.131(192.168.68.131:3306) (current master) 32 +--192.168.68.132(192.168.68.132:3306) 33 +--192.168.68.133(192.168.68.133:3306) 34 35Sat Aug 8 09:59:33 2020 - [info] Checking replication health on 192.168.68.132.. 36Sat Aug 8 09:59:33 2020 - [info] ok. 37Sat Aug 8 09:59:33 2020 - [info] Checking replication health on 192.168.68.133.. 38Sat Aug 8 09:59:33 2020 - [info] ok. 39Sat Aug 8 09:59:33 2020 - [info] Checking master_ip_failover_script status: 40Sat Aug 8 09:59:33 2020 - [info] /usr/local/mha/scripts/master_ip_failover --command=status --ssh_user=root --orig_master_host=192.168.68.131 --orig_master_ip=192.168.68.131 --orig_master_port=3306 41 42 43IN SCRIPT TEST====/sbin/ip addr del 192.168.68.135/24 dev eth0==/sbin/ifconfig eth0:1 192.168.68.135/24=== 44 45Checking the Status of the script.. OK 46Sat Aug 8 09:59:33 2020 - [info] OK. 47Sat Aug 8 09:59:33 2020 - [warning] shutdown_script is not defined. 48Sat Aug 8 09:59:33 2020 - [info] Got exit code 0 (Not master dead). 49 50MySQL Replication Health is OK.
“MySQL Replication Health is OK.”表示1主2从的架构目前是正常的。
3.1.3 检查MHA状态:
1[root@MHA-LHR-Monitor-ip134 /]# masterha_check_status --conf=/etc/mha/mha.cnf 2mha is stopped(2:NOT_RUNNING).
1[root@lhrdocker ~]# mysql -uroot -plhr -h192.168.68.135 -P3306 2mysql: [Warning] Using a password on the command line interface can be insecure. 3Welcome to the MySQL monitor. Commands endwith ; or \g. 4Your MySQL connection id is 10 5Server version: 5.7.30-log MySQL Community Server (GPL) 6 7Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. 8 9Oracle is a registered trademark of Oracle Corporation and/or its 10affiliates. Other names may be trademarks of their respective 11owners. 12 13Type 'help;' or '\h' for help. Type'\c'toclear the currentinput statement. 14 15mysql> select @@hostname; 16+-----------------------+ 17| @@hostname | 18+-----------------------+ 19| MHA-LHR-Master1-ip131 | 20+-----------------------+ 211 row in set (0.00 sec) 22 23mysql> showslavehosts; 24+-----------+----------------+------+-----------+--------------------------------------+ 25| Server_id | Host | Port | Master_id | Slave_UUID | 26+-----------+----------------+------+-----------+--------------------------------------+ 27| 573306133 | 192.168.68.133 | 3306 | 573306131 | d391ce7e-aec3-11ea-94cd-0242c0a84485 | 28| 573306132 | 192.168.68.132 | 3306 | 573306131 | d24a77d1-aec3-11ea-9399-0242c0a84484 | 29+-----------+----------------+------+-----------+--------------------------------------+ 302 rows in set (0.00 sec)
1[root@MHA-LHR-Monitor-ip134 /]# tailf /usr/local/mha/manager_running.log 2 3Sat Aug 8 11:01:23 2020 - [warning] Got error on MySQL select ping: 2013 (Lost connection to MySQL server during query) 4Sat Aug 8 11:01:23 2020 - [info] Executing secondary network check script: /usr/local/bin/masterha_secondary_check -s MHA-LHR-Slave1-ip132 -s MHA-LHR-Slave2-ip133 --user=root --master_host=MHA-LHR-Master1-ip131 --master_ip=192.168.68.131 --master_port=3306 --user=root --master_host=192.168.68.131 --master_ip=192.168.68.131 --master_port=3306 --master_user=mha --master_password=lhr --ping_type=SELECT 5Sat Aug 8 11:01:23 2020 - [info] Executing SSH check script: exit 0 6Sat Aug 8 11:01:23 2020 - [warning] HealthCheck: SSH to 192.168.68.131 is NOT reachable. 7Monitoring server MHA-LHR-Slave1-ip132 is reachable, Master is not reachable from MHA-LHR-Slave1-ip132. OK. 8Monitoring server MHA-LHR-Slave2-ip133 is reachable, Master is not reachable from MHA-LHR-Slave2-ip133. OK. 9Sat Aug 8 11:01:23 2020 - [info] Master is not reachable from all other monitoring servers. Failover should start. 10Sat Aug 8 11:01:24 2020 - [warning] Got error on MySQL connect: 2003 (Can't connect to MySQL server on '192.168.68.131' (4)) 11Sat Aug 8 11:01:24 2020 - [warning] Connection failed 2 time(s).. 12Sat Aug 8 11:01:25 2020 - [warning] Got error on MySQL connect: 2003 (Can't connect to MySQL server on '192.168.68.131' (4)) 13Sat Aug 8 11:01:25 2020 - [warning] Connection failed 3 time(s).. 14Sat Aug 8 11:01:26 2020 - [warning] Got error on MySQL connect: 2003 (Can't connect to MySQL server on '192.168.68.131' (4)) 15Sat Aug 8 11:01:26 2020 - [warning] Connection failed 4 time(s).. 16Sat Aug 8 11:01:26 2020 - [warning] Master is not reachable from health checker! 17Sat Aug 8 11:01:26 2020 - [warning] Master 192.168.68.131(192.168.68.131:3306) is not reachable! 18Sat Aug 8 11:01:26 2020 - [warning] SSH is NOT reachable. 19Sat Aug 8 11:01:26 2020 - [info] Connecting to a master server failed. Reading configuration file /etc/masterha_default.cnf and /etc/mha/mha.cnf again, and trying to connect to all servers to check server status.. 20Sat Aug 8 11:01:26 2020 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping. 21Sat Aug 8 11:01:26 2020 - [info] Reading application default configuration from /etc/mha/mha.cnf.. 22Sat Aug 8 11:01:26 2020 - [info] Reading server configuration from /etc/mha/mha.cnf.. 23Sat Aug 8 11:01:27 2020 - [info] GTID failover mode = 1 24Sat Aug 8 11:01:27 2020 - [info] Dead Servers: 25Sat Aug 8 11:01:27 2020 - [info] 192.168.68.131(192.168.68.131:3306) 26Sat Aug 8 11:01:27 2020 - [info] Alive Servers: 27Sat Aug 8 11:01:27 2020 - [info] 192.168.68.132(192.168.68.132:3306) 28Sat Aug 8 11:01:27 2020 - [info] 192.168.68.133(192.168.68.133:3306) 29Sat Aug 8 11:01:27 2020 - [info] Alive Slaves: 30Sat Aug 8 11:01:27 2020 - [info] 192.168.68.132(192.168.68.132:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 31Sat Aug 8 11:01:27 2020 - [info] GTID ON 32Sat Aug 8 11:01:27 2020 - [info] Replicating from 192.168.68.131(192.168.68.131:3306) 33Sat Aug 8 11:01:27 2020 - [info] Primary candidate for the new Master (candidate_master is set) 34Sat Aug 8 11:01:27 2020 - [info] 192.168.68.133(192.168.68.133:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 35Sat Aug 8 11:01:27 2020 - [info] GTID ON 36Sat Aug 8 11:01:27 2020 - [info] Replicating from 192.168.68.131(192.168.68.131:3306) 37Sat Aug 8 11:01:27 2020 - [info] Checking slave configurations.. 38Sat Aug 8 11:01:27 2020 - [info] read_only=1 is not set on slave 192.168.68.132(192.168.68.132:3306). 39Sat Aug 8 11:01:27 2020 - [info] read_only=1 is not set on slave 192.168.68.133(192.168.68.133:3306). 40Sat Aug 8 11:01:27 2020 - [info] Checking replication filtering settings.. 41Sat Aug 8 11:01:27 2020 - [info] Replication filtering check ok. 42Sat Aug 8 11:01:27 2020 - [info] Master is down! 43Sat Aug 8 11:01:27 2020 - [info] Terminating monitoring script. 44Sat Aug 8 11:01:27 2020 - [info] Got exit code 20 (Master dead). 45Sat Aug 8 11:01:27 2020 - [info] MHA::MasterFailover version 0.58. 46Sat Aug 8 11:01:27 2020 - [info] Starting master failover. 47Sat Aug 8 11:01:27 2020 - [info] 48Sat Aug 8 11:01:27 2020 - [info] * Phase 1: Configuration Check Phase.. 49Sat Aug 8 11:01:27 2020 - [info] 50Sat Aug 8 11:01:29 2020 - [info] GTID failover mode = 1 51Sat Aug 8 11:01:29 2020 - [info] Dead Servers: 52Sat Aug 8 11:01:29 2020 - [info] 192.168.68.131(192.168.68.131:3306) 53Sat Aug 8 11:01:29 2020 - [info] Checking master reachability via MySQL(double check)... 54Sat Aug 8 11:01:30 2020 - [info] ok. 55Sat Aug 8 11:01:30 2020 - [info] Alive Servers: 56Sat Aug 8 11:01:30 2020 - [info] 192.168.68.132(192.168.68.132:3306) 57Sat Aug 8 11:01:30 2020 - [info] 192.168.68.133(192.168.68.133:3306) 58Sat Aug 8 11:01:30 2020 - [info] Alive Slaves: 59Sat Aug 8 11:01:30 2020 - [info] 192.168.68.132(192.168.68.132:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 60Sat Aug 8 11:01:30 2020 - [info] GTID ON 61Sat Aug 8 11:01:30 2020 - [info] Replicating from 192.168.68.131(192.168.68.131:3306) 62Sat Aug 8 11:01:30 2020 - [info] Primary candidate for the new Master (candidate_master is set) 63Sat Aug 8 11:01:30 2020 - [info] 192.168.68.133(192.168.68.133:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 64Sat Aug 8 11:01:30 2020 - [info] GTID ON 65Sat Aug 8 11:01:30 2020 - [info] Replicating from 192.168.68.131(192.168.68.131:3306) 66Sat Aug 8 11:01:30 2020 - [info] Starting GTID based failover. 67Sat Aug 8 11:01:30 2020 - [info] 68Sat Aug 8 11:01:30 2020 - [info] ** Phase 1: Configuration Check Phase completed. 69Sat Aug 8 11:01:30 2020 - [info] 70Sat Aug 8 11:01:30 2020 - [info] * Phase 2: Dead Master Shutdown Phase.. 71Sat Aug 8 11:01:30 2020 - [info] 72Sat Aug 8 11:01:30 2020 - [info] Forcing shutdown so that applications never connect to the current master.. 73Sat Aug 8 11:01:30 2020 - [info] Executing master IP deactivation script: 74Sat Aug 8 11:01:30 2020 - [info] /usr/local/mha/scripts/master_ip_failover --orig_master_host=192.168.68.131 --orig_master_ip=192.168.68.131 --orig_master_port=3306 --command=stop 75 76 77IN SCRIPT TEST====/sbin/ip addr del 192.168.68.135/24 dev eth0==/sbin/ifconfig eth0:1 192.168.68.135/24=== 78 79Disabling the VIP on old master: 192.168.68.131 80Sat Aug 8 11:01:30 2020 - [info] done. 81Sat Aug 8 11:01:30 2020 - [warning] shutdown_script is not set. Skipping explicit shutting down of the dead master. 82Sat Aug 8 11:01:30 2020 - [info] * Phase 2: Dead Master Shutdown Phase completed. 83Sat Aug 8 11:01:30 2020 - [info] 84Sat Aug 8 11:01:30 2020 - [info] * Phase 3: Master Recovery Phase.. 85Sat Aug 8 11:01:30 2020 - [info] 86Sat Aug 8 11:01:30 2020 - [info] * Phase 3.1: Getting Latest Slaves Phase.. 87Sat Aug 8 11:01:30 2020 - [info] 88Sat Aug 8 11:01:30 2020 - [info] The latest binary log file/position on all slaves is MHA-LHR-Master1-ip131-bin.000011:234 89Sat Aug 8 11:01:30 2020 - [info] Latest slaves (Slaves that received relay log files to the latest): 90Sat Aug 8 11:01:30 2020 - [info] 192.168.68.132(192.168.68.132:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 91Sat Aug 8 11:01:30 2020 - [info] GTID ON 92Sat Aug 8 11:01:30 2020 - [info] Replicating from 192.168.68.131(192.168.68.131:3306) 93Sat Aug 8 11:01:30 2020 - [info] Primary candidate for the new Master (candidate_master is set) 94Sat Aug 8 11:01:30 2020 - [info] 192.168.68.133(192.168.68.133:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 95Sat Aug 8 11:01:30 2020 - [info] GTID ON 96Sat Aug 8 11:01:30 2020 - [info] Replicating from 192.168.68.131(192.168.68.131:3306) 97Sat Aug 8 11:01:30 2020 - [info] The oldest binary log file/position on all slaves is MHA-LHR-Master1-ip131-bin.000011:234 98Sat Aug 8 11:01:30 2020 - [info] Oldest slaves: 99Sat Aug 8 11:01:30 2020 - [info] 192.168.68.132(192.168.68.132:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 100Sat Aug 8 11:01:30 2020 - [info] GTID ON 101Sat Aug 8 11:01:30 2020 - [info] Replicating from 192.168.68.131(192.168.68.131:3306) 102Sat Aug 8 11:01:30 2020 - [info] Primary candidate for the new Master (candidate_master is set) 103Sat Aug 8 11:01:30 2020 - [info] 192.168.68.133(192.168.68.133:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 104Sat Aug 8 11:01:30 2020 - [info] GTID ON 105Sat Aug 8 11:01:30 2020 - [info] Replicating from 192.168.68.131(192.168.68.131:3306) 106Sat Aug 8 11:01:30 2020 - [info] 107Sat Aug 8 11:01:30 2020 - [info] * Phase 3.3: Determining New Master Phase.. 108Sat Aug 8 11:01:30 2020 - [info] 109Sat Aug 8 11:01:30 2020 - [info] Searching new master from slaves.. 110Sat Aug 8 11:01:30 2020 - [info] Candidate masters from the configuration file: 111Sat Aug 8 11:01:30 2020 - [info] 192.168.68.132(192.168.68.132:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 112Sat Aug 8 11:01:30 2020 - [info] GTID ON 113Sat Aug 8 11:01:30 2020 - [info] Replicating from 192.168.68.131(192.168.68.131:3306) 114Sat Aug 8 11:01:30 2020 - [info] Primary candidate for the new Master (candidate_master is set) 115Sat Aug 8 11:01:30 2020 - [info] Non-candidate masters: 116Sat Aug 8 11:01:30 2020 - [info] Searching from candidate_master slaves which have received the latest relay log events.. 117Sat Aug 8 11:01:30 2020 - [info] New master is 192.168.68.132(192.168.68.132:3306) 118Sat Aug 8 11:01:30 2020 - [info] Starting master failover.. 119Sat Aug 8 11:01:30 2020 - [info] 120From: 121192.168.68.131(192.168.68.131:3306) (current master) 122 +--192.168.68.132(192.168.68.132:3306) 123 +--192.168.68.133(192.168.68.133:3306) 124 125To: 126192.168.68.132(192.168.68.132:3306) (new master) 127 +--192.168.68.133(192.168.68.133:3306) 128Sat Aug 8 11:01:30 2020 - [info] 129Sat Aug 8 11:01:30 2020 - [info] * Phase 3.3: New Master Recovery Phase.. 130Sat Aug 8 11:01:30 2020 - [info] 131Sat Aug 8 11:01:30 2020 - [info] Waiting all logs to be applied.. 132Sat Aug 8 11:01:30 2020 - [info] done. 133Sat Aug 8 11:01:30 2020 - [info] Getting new master's binlog name and position.. 134Sat Aug 8 11:01:30 2020 - [info] MHA-LHR-Slave1-ip132-bin.000008:234 135Sat Aug 8 11:01:30 2020 - [info] All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='192.168.68.132', MASTER_PORT=3306, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='xxx'; 136Sat Aug 8 11:01:30 2020 - [info] Master Recovery succeeded. File:Pos:Exec_Gtid_Set: MHA-LHR-Slave1-ip132-bin.000008, 234, c8ca4f1d-aec3-11ea-942b-0242c0a84483:1-11, 137d24a77d1-aec3-11ea-9399-0242c0a84484:1-3 138Sat Aug 8 11:01:30 2020 - [info] Executing master IP activate script: 139Sat Aug 8 11:01:30 2020 - [info] /usr/local/mha/scripts/master_ip_failover --command=start --ssh_user=root --orig_master_host=192.168.68.131 --orig_master_ip=192.168.68.131 --orig_master_port=3306 --new_master_host=192.168.68.132 --new_master_ip=192.168.68.132 --new_master_port=3306 --new_master_user='mha' --new_master_password=xxx 140Unknown option: new_master_user 141Unknown option: new_master_password 142 143 144IN SCRIPT TEST====/sbin/ip addr del 192.168.68.135/24 dev eth0==/sbin/ifconfig eth0:1 192.168.68.135/24=== 145 146Enabling the VIP - 192.168.68.135/24 on the new master - 192.168.68.132 147Sat Aug 8 11:01:30 2020 - [info] OK. 148Sat Aug 8 11:01:30 2020 - [info] ** Finished master recovery successfully. 149Sat Aug 8 11:01:30 2020 - [info] * Phase 3: Master Recovery Phase completed. 150Sat Aug 8 11:01:30 2020 - [info] 151Sat Aug 8 11:01:30 2020 - [info] * Phase 4: Slaves Recovery Phase.. 152Sat Aug 8 11:01:30 2020 - [info] 153Sat Aug 8 11:01:30 2020 - [info] 154Sat Aug 8 11:01:30 2020 - [info] * Phase 4.1: Starting Slaves in parallel.. 155Sat Aug 8 11:01:30 2020 - [info] 156Sat Aug 8 11:01:30 2020 - [info] -- Slave recovery on host 192.168.68.133(192.168.68.133:3306) started, pid: 474. Check tmp log /usr/local/mha/192.168.68.133_3306_20200808110127.log if it takes time.. 157Sat Aug 8 11:01:32 2020 - [info] 158Sat Aug 8 11:01:32 2020 - [info] Log messages from 192.168.68.133 ... 159Sat Aug 8 11:01:32 2020 - [info] 160Sat Aug 8 11:01:30 2020 - [info] Resetting slave 192.168.68.133(192.168.68.133:3306) and starting replication from the new master 192.168.68.132(192.168.68.132:3306).. 161Sat Aug 8 11:01:30 2020 - [info] Executed CHANGE MASTER. 162Sat Aug 8 11:01:31 2020 - [info] Slave started. 163Sat Aug 8 11:01:31 2020 - [info] gtid_wait(c8ca4f1d-aec3-11ea-942b-0242c0a84483:1-11, 164d24a77d1-aec3-11ea-9399-0242c0a84484:1-3) completed on 192.168.68.133(192.168.68.133:3306). Executed 0 events. 165Sat Aug 8 11:01:32 2020 - [info] End of log messages from 192.168.68.133. 166Sat Aug 8 11:01:32 2020 - [info] -- Slave on host 192.168.68.133(192.168.68.133:3306) started. 167Sat Aug 8 11:01:32 2020 - [info] All new slave servers recovered successfully. 168Sat Aug 8 11:01:32 2020 - [info] 169Sat Aug 8 11:01:32 2020 - [info] * Phase 5: New master cleanup phase.. 170Sat Aug 8 11:01:32 2020 - [info] 171Sat Aug 8 11:01:32 2020 - [info] Resetting slave info on the new master.. 172Sat Aug 8 11:01:32 2020 - [info] 192.168.68.132: Resetting slave info succeeded. 173Sat Aug 8 11:01:32 2020 - [info] Master failover to 192.168.68.132(192.168.68.132:3306) completed successfully. 174Sat Aug 8 11:01:32 2020 - [info] 175 176----- Failover Report ----- 177 178mha: MySQL Master failover 192.168.68.131(192.168.68.131:3306) to 192.168.68.132(192.168.68.132:3306) succeeded 179 180Master 192.168.68.131(192.168.68.131:3306) is down! 181 182Check MHA Manager logs at MHA-LHR-Monitor-ip134:/usr/local/mha/manager_running.log for details. 183 184Started automated(non-interactive) failover. 185Invalidated master IP address on 192.168.68.131(192.168.68.131:3306) 186Selected 192.168.68.132(192.168.68.132:3306) as a new master. 187192.168.68.132(192.168.68.132:3306): OK: Applying all logs succeeded. 188192.168.68.132(192.168.68.132:3306): OK: Activated master IP address. 189192.168.68.133(192.168.68.133:3306): OK: Slave started, replicating from 192.168.68.132(192.168.68.132:3306) 190192.168.68.132(192.168.68.132:3306): Resetting slave info succeeded. 191Master failover to 192.168.68.132(192.168.68.132:3306) completed successfully. 192Sat Aug 8 11:01:32 2020 - [info] Sending mail..
⑤ 同时,邮件收到告警
注意:
1、首先确保你的134环境可以上外网
1[root@MHA-LHR-Monitor-ip134 /]# ping 8.8.8.8 2PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 364 bytes from 8.8.8.8: icmp_seq=1 ttl=127 time=109 ms 464 bytes from 8.8.8.8: icmp_seq=2 ttl=127 time=152 ms 564 bytes from 8.8.8.8: icmp_seq=3 ttl=127 time=132 ms 6^C 7--- 8.8.8.8 ping statistics --- 83 packets transmitted, 3 received, 0% packet loss, time 2004ms 9rtt min/avg/max/mdev = 109.295/131.671/152.728/17.758 ms 10[root@MHA-LHR-Monitor-ip134 /]#
1# 启动131 2docker start MHA-LHR-Master1-ip131 3 4# 在134的日志文件中找到恢复的语句 5grep "All other slaves should start replication from here" /usr/local/mha/manager_running.log 6 7# 在131上执行恢复 8CHANGE MASTER TO MASTER_HOST='192.168.68.132', MASTER_PORT=3306, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='lhr'; 9 10start slave; 11show slave status; 12 13# 在134上检查 14masterha_check_repl --conf=/etc/mha/mha.cnf
执行过程:
1[root@MHA-LHR-Monitor-ip134 /]# grep "All other slaves should start replication from here" /usr/local/mha/manager_running.log 2Mon Jun 15 14:16:31 2020 - [info] All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='192.168.68.132', MASTER_PORT=3306, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='xxx'; 3Sat Aug 8 11:01:30 2020 - [info] All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='192.168.68.132', MASTER_PORT=3306, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='xxx'; 4[root@MHA-LHR-Monitor-ip134 /]# 5[root@MHA-LHR-Monitor-ip134 /]# masterha_check_repl --conf=/etc/mha/mha.cnf 6Sat Aug 8 11:23:30 2020 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping. 7Sat Aug 8 11:23:30 2020 - [info] Reading application default configuration from /etc/mha/mha.cnf.. 8Sat Aug 8 11:23:30 2020 - [info] Reading server configuration from /etc/mha/mha.cnf.. 9Sat Aug 8 11:23:30 2020 - [info] MHA::MasterMonitor version 0.58. 10Sat Aug 8 11:23:32 2020 - [info] GTID failover mode = 1 11Sat Aug 8 11:23:32 2020 - [info] Dead Servers: 12Sat Aug 8 11:23:32 2020 - [info] Alive Servers: 13Sat Aug 8 11:23:32 2020 - [info] 192.168.68.131(192.168.68.131:3306) 14Sat Aug 8 11:23:32 2020 - [info] 192.168.68.132(192.168.68.132:3306) 15Sat Aug 8 11:23:32 2020 - [info] 192.168.68.133(192.168.68.133:3306) 16Sat Aug 8 11:23:32 2020 - [info] Alive Slaves: 17Sat Aug 8 11:23:32 2020 - [info] 192.168.68.131(192.168.68.131:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 18Sat Aug 8 11:23:32 2020 - [info] GTID ON 19Sat Aug 8 11:23:32 2020 - [info] Replicating from 192.168.68.132(192.168.68.132:3306) 20Sat Aug 8 11:23:32 2020 - [info] 192.168.68.133(192.168.68.133:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 21Sat Aug 8 11:23:32 2020 - [info] GTID ON 22Sat Aug 8 11:23:32 2020 - [info] Replicating from 192.168.68.132(192.168.68.132:3306) 23Sat Aug 8 11:23:32 2020 - [info] Current Alive Master: 192.168.68.132(192.168.68.132:3306) 24Sat Aug 8 11:23:32 2020 - [info] Checking slave configurations.. 25Sat Aug 8 11:23:32 2020 - [info] read_only=1 is not set on slave 192.168.68.131(192.168.68.131:3306). 26Sat Aug 8 11:23:32 2020 - [info] read_only=1 is not set on slave 192.168.68.133(192.168.68.133:3306). 27Sat Aug 8 11:23:32 2020 - [info] Checking replication filtering settings.. 28Sat Aug 8 11:23:32 2020 - [info] binlog_do_db= , binlog_ignore_db= information_schema,mysql,performance_schema,sys 29Sat Aug 8 11:23:32 2020 - [info] Replication filtering check ok. 30Sat Aug 8 11:23:32 2020 - [info] GTID (with auto-pos) is supported. Skipping all SSH and Node package checking. 31Sat Aug 8 11:23:32 2020 - [info] Checking SSH publickey authentication settings on the current master.. 32Sat Aug 8 11:23:32 2020 - [info] HealthCheck: SSH to 192.168.68.132 is reachable. 33Sat Aug 8 11:23:32 2020 - [info] 34192.168.68.132(192.168.68.132:3306) (current master) 35 +--192.168.68.131(192.168.68.131:3306) 36 +--192.168.68.133(192.168.68.133:3306) 37 38Sat Aug 8 11:23:32 2020 - [info] Checking replication health on 192.168.68.131.. 39Sat Aug 8 11:23:32 2020 - [info] ok. 40Sat Aug 8 11:23:32 2020 - [info] Checking replication health on 192.168.68.133.. 41Sat Aug 8 11:23:32 2020 - [info] ok. 42Sat Aug 8 11:23:32 2020 - [info] Checking master_ip_failover_script status: 43Sat Aug 8 11:23:32 2020 - [info] /usr/local/mha/scripts/master_ip_failover --command=status --ssh_user=root --orig_master_host=192.168.68.132 --orig_master_ip=192.168.68.132 --orig_master_port=3306 44 45 46IN SCRIPT TEST====/sbin/ip addr del 192.168.68.135/24 dev eth0==/sbin/ifconfig eth0:1 192.168.68.135/24=== 47 48Checking the Status of the script.. OK 49Sat Aug 8 11:23:32 2020 - [info] OK. 50Sat Aug 8 11:23:32 2020 - [warning] shutdown_script is not defined. 51Sat Aug 8 11:23:32 2020 - [info] Got exit code 0 (Not master dead). 52 53MySQL Replication Health is OK.
1[root@MHA-LHR-Monitor-ip134 /]# masterha_check_repl --conf=/etc/mha/mha.cnf 2Sat Aug 8 11:23:30 2020 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping. 3Sat Aug 8 11:23:30 2020 - [info] Reading application default configuration from /etc/mha/mha.cnf.. 4Sat Aug 8 11:23:30 2020 - [info] Reading server configuration from /etc/mha/mha.cnf.. 5Sat Aug 8 11:23:30 2020 - [info] MHA::MasterMonitor version 0.58. 6Sat Aug 8 11:23:32 2020 - [info] GTID failover mode = 1 7Sat Aug 8 11:23:32 2020 - [info] Dead Servers: 8Sat Aug 8 11:23:32 2020 - [info] Alive Servers: 9Sat Aug 8 11:23:32 2020 - [info] 192.168.68.131(192.168.68.131:3306) 10Sat Aug 8 11:23:32 2020 - [info] 192.168.68.132(192.168.68.132:3306) 11Sat Aug 8 11:23:32 2020 - [info] 192.168.68.133(192.168.68.133:3306) 12Sat Aug 8 11:23:32 2020 - [info] Alive Slaves: 13Sat Aug 8 11:23:32 2020 - [info] 192.168.68.131(192.168.68.131:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 14Sat Aug 8 11:23:32 2020 - [info] GTID ON 15Sat Aug 8 11:23:32 2020 - [info] Replicating from 192.168.68.132(192.168.68.132:3306) 16Sat Aug 8 11:23:32 2020 - [info] 192.168.68.133(192.168.68.133:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 17Sat Aug 8 11:23:32 2020 - [info] GTID ON 18Sat Aug 8 11:23:32 2020 - [info] Replicating from 192.168.68.132(192.168.68.132:3306) 19Sat Aug 8 11:23:32 2020 - [info] Current Alive Master: 192.168.68.132(192.168.68.132:3306) 20Sat Aug 8 11:23:32 2020 - [info] Checking slave configurations.. 21Sat Aug 8 11:23:32 2020 - [info] read_only=1 is not set on slave 192.168.68.131(192.168.68.131:3306). 22Sat Aug 8 11:23:32 2020 - [info] read_only=1 is not set on slave 192.168.68.133(192.168.68.133:3306). 23Sat Aug 8 11:23:32 2020 - [info] Checking replication filtering settings.. 24Sat Aug 8 11:23:32 2020 - [info] binlog_do_db= , binlog_ignore_db= information_schema,mysql,performance_schema,sys 25Sat Aug 8 11:23:32 2020 - [info] Replication filtering check ok. 26Sat Aug 8 11:23:32 2020 - [info] GTID (with auto-pos) is supported. Skipping all SSH and Node package checking. 27Sat Aug 8 11:23:32 2020 - [info] Checking SSH publickey authentication settings on the current master.. 28Sat Aug 8 11:23:32 2020 - [info] HealthCheck: SSH to 192.168.68.132 is reachable. 29Sat Aug 8 11:23:32 2020 - [info] 30192.168.68.132(192.168.68.132:3306) (current master) 31 +--192.168.68.131(192.168.68.131:3306) 32 +--192.168.68.133(192.168.68.133:3306) 33 34Sat Aug 8 11:23:32 2020 - [info] Checking replication health on 192.168.68.131.. 35Sat Aug 8 11:23:32 2020 - [info] ok. 36Sat Aug 8 11:23:32 2020 - [info] Checking replication health on 192.168.68.133.. 37Sat Aug 8 11:23:32 2020 - [info] ok. 38Sat Aug 8 11:23:32 2020 - [info] Checking master_ip_failover_script status: 39Sat Aug 8 11:23:32 2020 - [info] /usr/local/mha/scripts/master_ip_failover --command=status --ssh_user=root --orig_master_host=192.168.68.132 --orig_master_ip=192.168.68.132 --orig_master_port=3306 40 41 42IN SCRIPT TEST====/sbin/ip addr del 192.168.68.135/24 dev eth0==/sbin/ifconfig eth0:1 192.168.68.135/24=== 43 44Checking the Status of the script.. OK 45Sat Aug 8 11:23:32 2020 - [info] OK. 46Sat Aug 8 11:23:32 2020 - [warning] shutdown_script is not defined. 47Sat Aug 8 11:23:32 2020 - [info] Got exit code 0 (Not master dead). 48 49MySQL Replication Health is OK. 50[root@MHA-LHR-Monitor-ip134 /]# masterha_master_switch --conf=/etc/mha/mha.cnf --master_state=alive \ 51> --orig_master_is_new_slave --running_updates_limit=10000 --interactive=0 \ 52> --new_master_host=192.168.68.131 --new_master_port=3306 53Sat Aug 8 11:26:36 2020 - [info] MHA::MasterRotate version 0.58. 54Sat Aug 8 11:26:36 2020 - [info] Starting online master switch.. 55Sat Aug 8 11:26:36 2020 - [info] 56Sat Aug 8 11:26:36 2020 - [info] * Phase 1: Configuration Check Phase.. 57Sat Aug 8 11:26:36 2020 - [info] 58Sat Aug 8 11:26:36 2020 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping. 59Sat Aug 8 11:26:36 2020 - [info] Reading application default configuration from /etc/mha/mha.cnf.. 60Sat Aug 8 11:26:36 2020 - [info] Reading server configuration from /etc/mha/mha.cnf.. 61Sat Aug 8 11:26:37 2020 - [info] GTID failover mode = 1 62Sat Aug 8 11:26:37 2020 - [info] Current Alive Master: 192.168.68.132(192.168.68.132:3306) 63Sat Aug 8 11:26:37 2020 - [info] Alive Slaves: 64Sat Aug 8 11:26:37 2020 - [info] 192.168.68.131(192.168.68.131:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 65Sat Aug 8 11:26:37 2020 - [info] GTID ON 66Sat Aug 8 11:26:37 2020 - [info] Replicating from 192.168.68.132(192.168.68.132:3306) 67Sat Aug 8 11:26:37 2020 - [info] 192.168.68.133(192.168.68.133:3306) Version=5.7.30-log (oldest major version between slaves) log-bin:enabled 68Sat Aug 8 11:26:37 2020 - [info] GTID ON 69Sat Aug 8 11:26:37 2020 - [info] Replicating from 192.168.68.132(192.168.68.132:3306) 70Sat Aug 8 11:26:37 2020 - [info] Executing FLUSH NO_WRITE_TO_BINLOG TABLES. This may take long time.. 71Sat Aug 8 11:26:37 2020 - [info] ok. 72Sat Aug 8 11:26:37 2020 - [info] Checking MHA is not monitoring or doing failover.. 73Sat Aug 8 11:26:37 2020 - [info] Checking replication health on 192.168.68.131.. 74Sat Aug 8 11:26:37 2020 - [info] ok. 75Sat Aug 8 11:26:37 2020 - [info] Checking replication health on 192.168.68.133.. 76Sat Aug 8 11:26:37 2020 - [info] ok. 77Sat Aug 8 11:26:37 2020 - [info] 192.168.68.131 can be new master. 78Sat Aug 8 11:26:37 2020 - [info] 79From: 80192.168.68.132(192.168.68.132:3306) (current master) 81 +--192.168.68.131(192.168.68.131:3306) 82 +--192.168.68.133(192.168.68.133:3306) 83 84To: 85192.168.68.131(192.168.68.131:3306) (new master) 86 +--192.168.68.133(192.168.68.133:3306) 87 +--192.168.68.132(192.168.68.132:3306) 88Sat Aug 8 11:26:37 2020 - [info] Checking whether 192.168.68.131(192.168.68.131:3306) is ok for the new master.. 89Sat Aug 8 11:26:37 2020 - [info] ok. 90Sat Aug 8 11:26:37 2020 - [info] 192.168.68.132(192.168.68.132:3306): SHOW SLAVE STATUS returned empty result. To check replication filtering rules, temporarily executing CHANGE MASTER to a dummy host. 91Sat Aug 8 11:26:37 2020 - [info] 192.168.68.132(192.168.68.132:3306): Resetting slave pointing to the dummy host. 92Sat Aug 8 11:26:37 2020 - [info] ** Phase 1: Configuration Check Phase completed. 93Sat Aug 8 11:26:37 2020 - [info] 94Sat Aug 8 11:26:37 2020 - [info] * Phase 2: Rejecting updates Phase.. 95Sat Aug 8 11:26:37 2020 - [info] 96Sat Aug 8 11:26:37 2020 - [info] Executing master ip online change script to disable write on the current master: 97Sat Aug 8 11:26:37 2020 - [info] /usr/local/mha/scripts/master_ip_online_change --command=stop --orig_master_host=192.168.68.132 --orig_master_ip=192.168.68.132 --orig_master_port=3306 --orig_master_user='mha' --new_master_host=192.168.68.131 --new_master_ip=192.168.68.131 --new_master_port=3306 --new_master_user='mha' --orig_master_ssh_user=root --new_master_ssh_user=root --orig_master_is_new_slave --orig_master_password=xxx --new_master_password=xxx 98Sat Aug 8 11:26:37 2020 758267 Set read_only on the new master.. ok. 99Sat Aug 8 11:26:37 2020 763087 Waiting all running 2 threads are disconnected.. (max 1500 milliseconds) 100{'Time' => '1507','db' => undef,'Id' => '14','User' => 'repl','State' => 'Master has sent all binlog to slave; waiting for more updates','Command' => 'Binlog Dump GTID','Info' => undef,'Host' => '192.168.68.133:60218'} 101{'Time' => '227','db' => undef,'Id' => '18','User' => 'repl','State' => 'Master has sent all binlog to slave; waiting for more updates','Command' => 'Binlog Dump GTID','Info' => undef,'Host' => '192.168.68.131:60292'} 102Sat Aug 8 11:26:38 2020 267483 Waiting all running 2 threads are disconnected.. (max 1000 milliseconds) 103{'Time' => '1508','db' => undef,'Id' => '14','User' => 'repl','State' => 'Master has sent all binlog to slave; waiting for more updates','Command' => 'Binlog Dump GTID','Info' => undef,'Host' => '192.168.68.133:60218'} 104{'Time' => '228','db' => undef,'Id' => '18','User' => 'repl','State' => 'Master has sent all binlog to slave; waiting for more updates','Command' => 'Binlog Dump GTID','Info' => undef,'Host' => '192.168.68.131:60292'} 105Sat Aug 8 11:26:38 2020 771131 Waiting all running 2 threads are disconnected.. (max 500 milliseconds) 106{'Time' => '1508','db' => undef,'Id' => '14','User' => 'repl','State' => 'Master has sent all binlog to slave; waiting for more updates','Command' => 'Binlog Dump GTID','Info' => undef,'Host' => '192.168.68.133:60218'} 107{'Time' => '228','db' => undef,'Id' => '18','User' => 'repl','State' => 'Master has sent all binlog to slave; waiting for more updates','Command' => 'Binlog Dump GTID','Info' => undef,'Host' => '192.168.68.131:60292'} 108Sat Aug 8 11:26:39 2020 274787 Set read_only=1 on the orig master.. ok. 109Sat Aug 8 11:26:39 2020 276192 Waiting all running 2 queries are disconnected.. (max 500 milliseconds) 110{'Time' => '1509','db' => undef,'Id' => '14','User' => 'repl','State' => 'Master has sent all binlog to slave; waiting for more updates','Command' => 'Binlog Dump GTID','Info' => undef,'Host' => '192.168.68.133:60218'} 111{'Time' => '229','db' => undef,'Id' => '18','User' => 'repl','State' => 'Master has sent all binlog to slave; waiting for more updates','Command' => 'Binlog Dump GTID','Info' => undef,'Host' => '192.168.68.131:60292'} 112Sat Aug 8 11:26:39 2020 778101 Killing all application threads.. 113Sat Aug 8 11:26:39 2020 778804 done. 114Disabling the VIP an old master: 192.168.68.132 115Warning: Executing wildcard deletion to stay compatible with old scripts. 116 Explicitly specify the prefix length (192.168.68.135/32) to avoid this warning. 117 This special behaviour is likely to disappear in further releases, 118 fix your scripts! 119Sat Aug 8 11:26:39 2020 - [info] ok. 120Sat Aug 8 11:26:39 2020 - [info] Locking all tables on the orig master to reject updates from everybody (including root): 121Sat Aug 8 11:26:39 2020 - [info] Executing FLUSH TABLES WITH READ LOCK.. 122Sat Aug 8 11:26:39 2020 - [info] ok. 123Sat Aug 8 11:26:39 2020 - [info] Orig master binlog:pos is MHA-LHR-Slave1-ip132-bin.000008:234. 124Sat Aug 8 11:26:39 2020 - [info] Waiting to execute all relay logs on 192.168.68.131(192.168.68.131:3306).. 125Sat Aug 8 11:26:39 2020 - [info] master_pos_wait(MHA-LHR-Slave1-ip132-bin.000008:234) completed on 192.168.68.131(192.168.68.131:3306). Executed 0 events. 126Sat Aug 8 11:26:39 2020 - [info] done. 127Sat Aug 8 11:26:39 2020 - [info] Getting new master's binlog name and position.. 128Sat Aug 8 11:26:39 2020 - [info] MHA-LHR-Master1-ip131-bin.000013:234 129Sat Aug 8 11:26:39 2020 - [info] All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='192.168.68.131', MASTER_PORT=3306, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='xxx'; 130Sat Aug 8 11:26:39 2020 - [info] Executing master ip online change script to allow write on the new master: 131Sat Aug 8 11:26:39 2020 - [info] /usr/local/mha/scripts/master_ip_online_change --command=start --orig_master_host=192.168.68.132 --orig_master_ip=192.168.68.132 --orig_master_port=3306 --orig_master_user='mha' --new_master_host=192.168.68.131 --new_master_ip=192.168.68.131 --new_master_port=3306 --new_master_user='mha' --orig_master_ssh_user=root --new_master_ssh_user=root --orig_master_is_new_slave --orig_master_password=xxx --new_master_password=xxx 132Sat Aug 8 11:26:40 2020 027564 Set read_only=0 on the new master. 133Enabling the VIP 192.168.68.135 on the new master: 192.168.68.131 134Sat Aug 8 11:26:42 2020 - [info] ok. 135Sat Aug 8 11:26:42 2020 - [info] 136Sat Aug 8 11:26:42 2020 - [info] * Switching slaves in parallel.. 137Sat Aug 8 11:26:42 2020 - [info] 138Sat Aug 8 11:26:42 2020 - [info] -- Slave switch on host 192.168.68.133(192.168.68.133:3306) started, pid: 640 139Sat Aug 8 11:26:42 2020 - [info] 140Sat Aug 8 11:26:44 2020 - [info] Log messages from 192.168.68.133 ... 141Sat Aug 8 11:26:44 2020 - [info] 142Sat Aug 8 11:26:42 2020 - [info] Waiting to execute all relay logs on 192.168.68.133(192.168.68.133:3306).. 143Sat Aug 8 11:26:42 2020 - [info] master_pos_wait(MHA-LHR-Slave1-ip132-bin.000008:234) completed on 192.168.68.133(192.168.68.133:3306). Executed 0 events. 144Sat Aug 8 11:26:42 2020 - [info] done. 145Sat Aug 8 11:26:42 2020 - [info] Resetting slave 192.168.68.133(192.168.68.133:3306) and starting replication from the new master 192.168.68.131(192.168.68.131:3306).. 146Sat Aug 8 11:26:42 2020 - [info] Executed CHANGE MASTER. 147Sat Aug 8 11:26:43 2020 - [info] Slave started. 148Sat Aug 8 11:26:44 2020 - [info] End of log messages from 192.168.68.133 ... 149Sat Aug 8 11:26:44 2020 - [info] 150Sat Aug 8 11:26:44 2020 - [info] -- Slave switch on host 192.168.68.133(192.168.68.133:3306) succeeded. 151Sat Aug 8 11:26:44 2020 - [info] Unlocking all tables on the orig master: 152Sat Aug 8 11:26:44 2020 - [info] Executing UNLOCK TABLES.. 153Sat Aug 8 11:26:44 2020 - [info] ok. 154Sat Aug 8 11:26:44 2020 - [info] Starting orig master as a new slave.. 155Sat Aug 8 11:26:44 2020 - [info] Resetting slave 192.168.68.132(192.168.68.132:3306) and starting replication from the new master 192.168.68.131(192.168.68.131:3306).. 156Sat Aug 8 11:26:44 2020 - [info] Executed CHANGE MASTER. 157Sat Aug 8 11:26:44 2020 - [info] Slave started. 158Sat Aug 8 11:26:44 2020 - [info] All new slave servers switched successfully. 159Sat Aug 8 11:26:44 2020 - [info] 160Sat Aug 8 11:26:44 2020 - [info] * Phase 5: New master cleanup phase.. 161Sat Aug 8 11:26:44 2020 - [info] 162Sat Aug 8 11:26:44 2020 - [info] 192.168.68.131: Resetting slave info succeeded. 163Sat Aug 8 11:26:44 2020 - [info] Switching master to 192.168.68.131(192.168.68.131:3306) completed successfully. 164
Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。
Sublime Text
Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。