global_defs { # 當上 Master 後,延遲 5 秒發送 GARP garp_master_delay 5 # 之後每 1 秒發一次 garp_master_refresh 1 script_user gjadmin enable_script_security } vrrp_script check_haproxy { script "/usr/bin/pgrep haproxy" interval 2 weight -20 } vrrp_instance VI_1 { state BACKUP # 角色:備機 (注意這裡) interface enp1s0 # 確認網卡名稱是否正確 virtual_router_id 51 # 必須跟 Master 一樣 priority 90 # 權重:比 Master 低 (例如 90) advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.10.0.83 # VIP } track_script { check_haproxy } }