当前位置:网站首页>Kept VRRP script, preemptive delay, VIP unicast details
Kept VRRP script, preemptive delay, VIP unicast details
2022-07-06 11:22:00 【Lin Weiwei_ 51CTO】

VRRP Script To configure
Define scripts
vrrp_script: Custom resource monitoring script ,vrrp The instance returns the value according to the script , Public definition , Can be called by multiple instances , set The meaning lies in vrrp Independent configuration blocks outside the instance , Generally placed on global_defs After setting the block .
vrrp_script <SCRIPT_NAME> {
script <STRING>|<QUOTED-STRING> # The return value of this script is non 0 when , Will trigger the following OPTIONS perform
OPTIONS
}
- 1.
- 2.
- 3.
- 4.
Usually, this script is used to monitor the status of the specified application . Once the application status is abnormal , Trigger pair MASTER The weight of the node is reduced To below SLAVE node , So as to achieve VIP Switch to SLAVE node
Call script
track_script: call vrrp_script Define scripts to monitor resources , It's defined in VRRP Within the example , Call the predefined vrrp_script
track_script {
SCRIPT_NAME_1
SCRIPT_NAME_2
}
- 1.
- 2.
- 3.
- 4.
Definition VRRP script
vrrp_script <SCRIPT_NAME> { # Define a detection script , stay global_defs External configuration
script <STRING>|<QUOTED-STRING> #shell Command or script path
interval <INTEGER> # Time interval between , The unit is in seconds , Default 1 second
timeout <INTEGER> # Timeout time
weight <INTEGER:-254..254> # The default is 0, If this value is set to a negative number , When the return value of the above script is non 0 when , Adding this value to the weight of this node can reduce the weight of this node , It indicates that the fall. If it's a positive number , When the return value of the script is 0, Adding this value to the weight of this node can improve the weight of this node , It indicates that the rise. Negative values are usually used
fall <INTEGER> # Executing the script failed several times in a row , Convert to failed , It is recommended to set 2 above
rise <INTEGER> # Execute the script successfully several times in a row , Mark the server from failure to success
user USERNAME [GROUPNAME] # The user or group that executes the monitoring script
init_fail # Set the default flag to failure status , After the monitoring is successful, it will be converted to the successful state
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
call VRRP script
vrrp_instance VI_1 {
…
track_script {
chk_down
}
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
Preemptive delay mode preempt_delay
Preemptive delay mode , That is, after the host with high priority is restored , Will not immediately grab back VIP, It's a delay ( Default 300s) Grab back VIP
preempt_delay # # The specified preemption delay time is #s, Default delay 300s
Be careful : It needs to be different keepalived The server state by BACKUP, And don't enable vrrp_strict
Example :
#ha1 Host configuration
vrrp_instance VI_1 {
state BACKUP # All for BACKUP
interface eth0
virtual_router_id 66
priority 100 # High priority
advert_int 1
preempt_delay 60 # Preemptive delay mode , Default delay 300s
#ha2 Host configuration
vrrp_instance VI_1 {
state BACKUP # All for BACKUP
interface eth0
virtual_router_id 66
priority 80 # Low priority
advert_int 1
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
VIP Unicast configuration
Default keepalived Multicast is used between hosts to announce messages to each other , Will cause network congestion , Can be replaced by unicast , Reduce network traffic
# At all nodes vrrp_instance Set the name of the opposite host in the statement block IP, It is recommended to set it to the address dedicated to the corresponding core jumper network , Instead of using business networks
unicast_src_ip <IPADDR> # Specify the source to send unicast IP
unicast_peer {
<IPADDR> # Specify the destination host of the other party receiving unicast IP
......
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
边栏推荐
- 机器学习笔记-Week02-卷积神经网络
- 打开浏览器的同时会在主页外同时打开芒果TV,抖音等网站
- 02 staff information management after the actual project
- Basic use of redis
- Why can't I use the @test annotation after introducing JUnit
- QT creator custom build process
- AcWing 1298.曹冲养猪 题解
- Windows cannot start the MySQL service (located on the local computer) error 1067 the process terminated unexpectedly
- L2-007 家庭房产 (25 分)
- [蓝桥杯2017初赛]包子凑数
猜你喜欢

Why can't I use the @test annotation after introducing JUnit

Introduction and use of automatic machine learning framework (flaml, H2O)

连接MySQL数据库出现错误:2059 - authentication plugin ‘caching_sha2_password‘的解决方法

In the era of DFI dividends, can TGP become a new benchmark for future DFI?

解决:log4j:WARN Please initialize the log4j system properly.

Solve the problem of installing failed building wheel for pilot

A trip to Macao - > see the world from a non line city to Macao

机器学习笔记-Week02-卷积神经网络

Generate PDM file from Navicat export table

Navicat 導出錶生成PDM文件
随机推荐
[recommended by bloggers] background management system of SSM framework (with source code)
基于apache-jena的知识问答
软件测试-面试题分享
[AGC009D]Uninity
Postman environment variable settings
Ansible practical Series III_ Task common commands
安装numpy问题总结
Ansible practical series I_ introduction
Project practice - background employee information management (add, delete, modify, check, login and exit)
Deoldify项目问题——OMP:Error#15:Initializing libiomp5md.dll,but found libiomp5md.dll already initialized.
How to set up voice recognition on the computer with shortcut keys
Ansible实战系列一 _ 入门
QT creator custom build process
MySQL主從複制、讀寫分離
Generate PDM file from Navicat export table
Why can't I use the @test annotation after introducing JUnit
In the era of DFI dividends, can TGP become a new benchmark for future DFI?
【博主推荐】SSM框架的后台管理系统(附源码)
QT creator support platform
Are you monitored by the company for sending resumes and logging in to job search websites? Deeply convinced that the product of "behavior awareness system ba" has not been retrieved on the official w