-
Notifications
You must be signed in to change notification settings - Fork 5
/
keepalived.conf
32 lines (27 loc) · 1.42 KB
/
keepalived.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
vrrp_script check_mysql8mgr {
script "/etc/keepalived/check_mysql8mgr.sh" # 检查脚本
interval 3 # 每3秒检查一次;
fall 2 # 脚本2次失败,认为异常;
rise 2 # 脚本2次成功,认为正常;
weight -5 # 认为异常后,priority值-5;
}
vrrp_instance MySQL8_MGR {
state BACKUP # 可以是:MASTER,BACKUP,不过当其他节点keepalived启动时会将priority比较大的节点选举为MASTER
interface eth0 # 节点固有IP(非VIP)的网卡,用来发VRRP包做心跳检测
virtual_router_id 133 # VRRP组名,两个节点的设置必须一样,以指明各个节点属于同一VRRP组
priority 100 # 主节点的优先级(1-254之间),备用节点必须比主节点优先级低。
advert_int 1 # 组播信息发送间隔,两个节点设置必须一样
# nopreempt # 设为非抢占;mgr则注释此处,需要抢占vip
authentication { # 设置验证信息,两个节点必须一致
auth_type PASS
auth_pass passw0rd
}
# notify_master "/etc/keepalived/check_mysql8mgr.sh master" # 变为 MASTER 时执行
# notify_backup "/etc/keepalived/check_mysql8mgr.sh backup" # 变为 BACKUP 时执行
virtual_ipaddress {
172.17.10.93/20 label eth0:1 # 虚拟IP,对外提供MySQL服务的IP地址
}
track_script {
check_mysql8mgr
}
}