This commit is contained in:
zeaslity
2024-10-30 16:30:51 +08:00
commit 437acbeb63
3363 changed files with 653948 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
! Configuration File for keepalived
global_defs {
router_id web-1 ##标识节点的字符串通常为本机hostname
}
vrrp_script chk_haproxy {
script "/etc/keepalived/haproxy_check.sh" ##执行脚本位置
interval 2 ##检测时间间隔
weight -20 ##如果条件成立则权重减20
}
vrrp_instance VI_2 {
state MASTER ## 主节点为MASTER备份节点为BACKUP-该配置非常重要
interface ens5 ## 绑定虚拟IP的网络接口网卡可以使用ifconfig查看
virtual_router_id 110 ## 虚拟路由ID号主备节点一定要相同-该配置非常重要
mcast_src_ip 10.165.81.66 ## 本机ip地址
priority 100 ##优先级配置0-254的值,一般主节点的权重大于备份节点
nopreempt
advert_int 2 ## 组播信息发送间隔俩个节点必须配置一致默认1s
authentication { ## 认证匹配
auth_type PASS
auth_pass woshinibaba
}
track_script {
chk_haproxy
}
virtual_ipaddress {
10.165.81.86 ## 虚拟ip
}
}