In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the principle and configuration of MySQL MHA high availability cluster in detail. It also introduces the startup method of MHA high availability cluster and the method of checking MHA status. I hope you can get something through this article.
MHA High availability Architecture deployment configuration example I. introduction to the principle of 1.1What's MHA?--
MHA--Master High Availability, currently a relatively mature solution for MySQL high availability, is a set of excellent high availability software for MySQL failover and master-slave upgrade.
< /dev/null >/ var/log/masterha/app1/manager.log 2 > & 1 & [1] 104076
-- remove_dead_master_conf this parameter means that when a master-slave switch occurs, the ip of the old master library will be removed from the configuration file.
-- location where manger_log logs are stored.
-- ignore_last_failover by default, if MHA detects continuous downtime and the interval between two outages is less than 8 hours, Failover will not be performed. This restriction is to avoid ping-pong effect. This parameter means to ignore the files generated by the last MHA trigger switch. By default, MHA will record the directory in the log after the switch, that is, the log app1.failover.complete file set above. If the file is found to exist in this directory next time, the switch will not be allowed, unless the file is deleted after the first switch. For convenience, it is set to-ignore_last_failover.
2.2.5 View MHA status
You can see that the current master is the primary service node, and the ip address is 192.168.68.129
[root@manager conf] # masterha_check_status-- conf=/etc/masterha/app1.cnfapp1 (pid:104076) is running (0:PING_OK), master:192.168.68.129# or view log You can also find the ip address of the primary server node [root@manager conf] # tail-2 / var/log/masterha/app1/manager.logTue Jan 14 17:12:48 2020-[info] Starting ping health check on 192.168.68.129 (192.168.68.129 tail 3306) ..Tue Jan 14 17:12:48 2020-[info] Ping (SELECT) succeeded, waiting until MySQL doesn't respond..2.2.6 verifies that the primary server is down
Of course, the first configuration requires manual configuration of VIP (virtual ip)
[root@master bin] # / sbin/ifconfig ens33:1 192.168.68.200 Ethernet 24 [root@master bin] # ifconfig ens33: flags=4163 mtu 1500 inet 192.168.68.129 netmask 255.255.255.0 broadcast 192.168.68.255 inet6 fe80::bdab:b59b:d041:d8b0 prefixlen 64 scopeid 0x20 ether 00:0c:29:e6:6d:eb txqueuelen 1000 (Ethernet) RX packets 775098 bytes 1083035145 (1.0 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 413307 bytes 31715433 (30.2 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ens33:1: flags=4163 mtu 1500 inet 192.168.68.200 netmask 255.255.255.0 broadcast 192.168.68.255 ether 00:0c:29:e6:6d:eb txqueuelen 1000 (Ethernet) lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 Inet6:: 1 prefixlen 128 scopeid 0x10 loop txqueuelen 1 (Local Loopback) RX packets 20 bytes 1568 (1.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 20 bytes 1568 (1.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0virbr0: flags=4099 mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.12255 ether 52dev 54VOV 43: 58 RX packets 6e txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Use pkill-9 mysql to simulate the downtime of the master server to see if the mysql slave server slave1 gets the vip address.
[root@slave1 bin] # ifconfig ens33: flags=4163 mtu 1500 inet 192.168.68.132 netmask 255.255.255.0 broadcast 192.168.68.255 inet6 fe80::4d95:1de7:d0a5:25c4 prefixlen 64 scopeid 0x20 ether 00:0c:29:0d:06:80 txqueuelen 1000 (Ethernet) RX packets 766652 bytes 1074024643 (1.0 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 379004 bytes 29740586 ) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ens33:1: flags=4163 mtu 1500 inet 192.168.68.200 netmask 255.255.255.0 broadcast 192.168.68.255 ether 00:0c:29:0d:06:80 txqueuelen 1000 (Ethernet) lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6:: 1 prefixlen 128 scopeid 0x10 loop txqueuelen 1 (Local Loopback) RX packets 146bytes 12570 (12.2KiB) RX errors 0 dropped 0 overruns 0frame 0TX packets 146bytes 12570 (12.2KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0virbr0: flags=4099 mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.12255 ether 52purge 5400 Vantage 86lav 1a txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
We can check the status of slave1 in its database.
Mysql > show slave status\ GEmpty set (0.00 sec) mysql > show master status-> +-+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +- -+ | master-bin.000001 | 1213 | +- -+ 1 row in set (0.00 sec)
Indicates that the primary service has been successfully switched from the database.
This is the end of the principle and configuration of MySQL MHA high availability cluster. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.