keepalived04:执行定制脚本
keepalived04:执行定制脚本
keepalived04:执行定制脚本
01
在MASTER,BACKUP切换后可以执行定制的脚本:
02
配置实例:
03
04
! Configuration File for keepalived
05
06
global_defs {
07
notification_email {
08
oscersong007@gmail.com
09
}
10
notification_email_from keepalived@localhost
11
smtp_server 127.0.0.1
12
smtp_connect_timeout 30
13
router_id LVS_DEVEL
14
}
15
vrrp_sync_group VGM {
16
group {
17
VI_1
18
}
19
notify_master /path/to/to_master.sh #表示当切换到master状态时,要执行的脚本
20
21
notify_backup /path_to/to_backup.sh #表示当切换到backup状态时,要执行的脚本
22
23
notify_fault "/path/fault.sh VG_1" #表示切换出现故障时要执行的脚本
24
25
}
26
vrrp_script chk_http_port {
27
script "killall -0 httpd"
28
interval 1
29
}
30
vrrp_instance VI_1 {
31
state BACKUP
32
interface eth0
33
virtual_router_id 51
34
priority 50
35
advert_int 1
36
authentication {
37
auth_type PASS
38
auth_pass westos
39
}
40
track_interface {
41
eth0
42
eth1
43
}
44
virtual_ipaddress {
45
192.168.0.150/24 dev eth0
46
10.0.0.150/24 dev eth1
47
}
48
track_script {
49
chk_http_port
50
}
51
}
评论暂时关闭