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 > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to prevent keepalived brain fissure problem, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
(1) third-party arbitration can be adopted. Because the state of the main and standby machines in the keepalived system is related to each other. If there is a network problem in the communication between the active and standby machines, there will be a brain fissure, and there will be a dual-master situation in the keepalived system, resulting in resource competition.
(2) generally, arbitration can be introduced to solve this problem, that is, each node must judge its own state. The simplest method of operation is to add the check configuration to the configuration file of the active and standby keepalived, and the server periodically ping the gateway. If the ping is not available, it thinks there is a problem with it.
(3) the easiest way is to implement it with vrrp_script and track_script provided by keepalived. As follows:
# vim / etc/keepalived/keepalived.conf
.
Vrrp_script check_local {
Script "/ root/check_gateway.sh"
Interval 5
}
.
Track_script {
Check_local
}
Content of the script:
# cat / root/check_gateway.sh
#! / bin/sh
VIP=$1
GATEWAY=192.168.1.1
/ sbin/arping-I em1-c 5-s $VIP $GATEWAY & > / dev/null
Check_gateway.sh is our arbitration logic. If we find that ping is not connected to the gateway, we will shut down keepalived.
(4) Detection idea: normally, the VIP address of keepalived is on the master node, and if the VIP is found in the slave node, the alarm message will be set. The script (on the slave node) is as follows:
Vim split-brainc_check.sh
#! / bin/bash
# check the script for brain fissure and deploy it on the standby node
LB01_VIP=192.168.1.229
LB01_IP=192.168.1.129
LB02_IP=192.168.1.130
While true
Do
Ping-c 2-W 3 $LB01_VIP & > / dev/null
If [$?-eq 0-a `ip add | grep "$LB01_VIP" | wc-l`-eq 1]; then
Echo "ha is brain."
Else
Echo "ha is ok"
Fi
Sleep 5
Done
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.