当前位置:网站首页>Kept - solve the problem that the primary and standby nodes seize the VIP at the same time
Kept - solve the problem that the primary and standby nodes seize the VIP at the same time
2022-07-19 00:08:00 【bojiSAMA】
List of articles
Reading tips
In this article VIP,vip,Vip It all refers to one thing
Virtual IP—— fictitious IP Address
Environmental Science
- centos 7.9
- master server _ Act as the master node (node1):172.24.8.124/16
Standby server _ Act as a standby node (node2):172.24.8.125/16 - Virtual IP Set to 172.24.8.242
This configuration is correct under normal operating environment
Master configuration
#yum install keepalived // Installed heartbeat detection package
#vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived
vrrp_script chk_nfs {
script "/etc/keepalived/chk_nfs.sh"
interval 2
weight -40
}
vrrp_instance node1 {
state MASTER # Master node flag ——MASTER
interface ens32
virtual_router_id 51
priority 100 # The highest priority level is 255, The priority of the primary node must be higher than that of the standby node ,
advert_int 1
unicast_src_ip 172.24.8.124
unicast_peer {
172.24.8.125
}
authentication {
auth_type PASS
auth_pass 1111
}
track_script {
chk_nfs
}
notify_stop /etc/keepalived/notify_stop.sh
notify_master /etc/keepalived/notify_master.sh
notify_backup /etc/keepalived/notify_backup.sh
virtual_ipaddress {
172.24.8.242
}
}
Standby node configuration
#yum install keepalived // Installed heartbeat detection package
#vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived
vrrp_script chk_nfs {
script "/etc/keepalived/chk_nfs.sh"
interval 2
weight -40
}
vrrp_instance node2 {
state BACKUP # Standby node flag ——BACKUP
interface ens32
virtual_router_id 51
priority 99 # The standby node should be smaller than the primary node
advert_int 1
unicast_src_ip 172.24.8.125 # Local network card IP
unicast_peer {
172.24.8.124 # Peer network card IP
}
authentication {
auth_type PASS
auth_pass 1111
}
track_script {
chk_nfs
}
notify_stop /etc/keepalived/notify_stop.sh
notify_master /etc/keepalived/notify_master.sh
notify_backup /etc/keepalived/notify_backup.sh
virtual_ipaddress {
172.24.8.242
}
}
Problems found in the test environment
The primary and standby nodes have Virtual IP, Therefore, it needs further analysis and solution .
Analyze and solve
Reasons for appearance
The reason for this problem is that in the server network environment , Because the routing switching layer is disabled ARP The broadcasting restrictions of , cause KEEPALIVE The master / standby protocol can't communicate through broadcast , Both the active and standby servers preempt Virtual-IP Address , Therefore, two servers have the same VIP The situation of address appears .
resolvent
- Specify... By configuration IP Thin communication between the two servers ( Based on the explanation in Alibaba cloud's description document, only two computers can use the same HAVIP Address )
- According to the analysis of the feasibility of this solution , Using the same method for multiple standby should be equally feasible .
stay node1 and node2 Add the following configurations respectively
node1 Configuration added by the master node
unicast_src_ip 172.24.8.124##( Local IP Address )
unicast_peer {
172.168.8.125#( Opposite end IP Address ) The address must not be forgotten
}
node2 Configuration added by the standby node
unicast_src_ip 172.24.8.125##( Local IP Address )
unicast_peer {
172.168.8.124#( Opposite end IP Address ) The address must not be forgotten
}
By adding unicast_src_ip and unicast_peer Parameter realizes unicast communication between the primary and standby nodes .
Test sequence
- node1,node2 Enable at the same time keepalived, And check their VIP Address
$ systemctl start keepalived
$ ip a
node1 There is vip
node2 It didn't show up vip
2. node1 close keepalived,Virtual ip towards node2 drift
$ systemctl stop keepalived #node1 operation
$ ip a #node1,node2 All operations to view vip The change of
node1 lost vip
node2 To obtain the vip
3. Turn it on again node1 Of keepalived service
$ systemctl start keepalived #node1 operation
$ ip a #node1,node2 All operations to view vip Address change
Master node node1 Again Vip
For the node node2 lost Vip
边栏推荐
猜你喜欢

Study with passion

学习要有激情

Glide 源码分析(4.13.2)

How to use redis to realize distributed cache

Redis has three modes -- master-slave replication, sentinel mode, and cluster

WordPress主题分享:The7主题v10.11免费下载 2022年最新版

9. Learn to check GC logs

AtCoder Beginner Contest 259 D Circumferences

How to deal with common errors in MySQL installation

Four years after graduation, I changed three software testing jobs. Why am I still anxious?
随机推荐
Envoy lifecycle management
Pytest interface automation testing framework | Interface Testing Overview
Pytest interface automation testing framework | pytest combines secondary packaging to realize interface automation
System.getProperty
MySQL internal architecture
shell条件判断练习
Redis distributed cache - redis master-slave
2022 latest Chinese Camtasia studio computer recording screen tool
Redis分布式缓存-Redis主从
The relationship between filedescriptor and open file in liunx
Envoy生命周期管理
Recommend a blog about instant messaging
乐观锁和悲观锁在kubernetes中的应用
How to improve query efficiency by using virtual columns provided by mysql5.7
[Baidu PaddlePaddle] handwritten numeral recognition model deployment pad influence
X Window
Clean the disk with CMD command (mainly the system disk)
从零开始配置 vim(4)——键盘映射的一些技巧
Four years after graduation, I changed three software testing jobs. Why am I still anxious?
15. Sum of three numbers [list < list < integer> > ans, ans.add (arrays.aslist (num[i], num[j], num[k]))]