歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> keepalived04:執行定制腳本

keepalived04:執行定制腳本

日期:2017/3/1 16:04:42   编辑:關於Linux
keepalived04:執行定制腳本 01 在MASTER,BACKUP切換後可以執行定制的腳本: 02 配置實例: 03 04 ! Configuration File for keepalived 05 06 global_defs { 07 notification_email { 08 [email protected] 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 }
Copyright © Linux教程網 All Rights Reserved