keepalived04:執行定製指令碼 01在MASTER,BACKUP切換後可以執行定製的指令碼:02配置執行個體:03 04! Configuration File for keepalived05 06global_defs {07 notification_email {08 oscersong007@gmail.com09 }10 notification_email_from keepalived@localhost11 smtp_server 127.0.0.112 smtp_connect_timeout 3013 router_id LVS_DEVEL14}15vrrp_sync_group VGM {16 group {17 VI_118 }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}26vrrp_script chk_http_port {27 script "killall -0 httpd"28 interval 129}30vrrp_instance VI_1 {31 state BACKUP32 interface eth033 virtual_router_id 5134 priority 5035 advert_int 136 authentication {37 auth_type PASS38 auth_pass westos39 }40 track_interface {41 eth042 eth143 }44 virtual_ipaddress {45 192.168.0.150/24 dev eth046 10.0.0.150/24 dev eth147 }48 track_script {49 chk_http_port50}51}