歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> keepalived的配置文件

keepalived的配置文件

日期:2017/3/3 16:37:25   编辑:關於Linux
! Configuration File for keepalived   
global_defs {   
     notification_email { #發生事件切換的時候,發送的郵箱,可以有多個,每行一個   
     [email protected]   
     }   
     notification_email_from [email protected]   
     smtp_server 127.0.0.1   
     smtp_connect_timeout 30   
     router_id LVS_DEVEL   
     }   
       
       
#VIP   
vrrp_instance VI_1 {   
     state MASTER           #備份服務器此處是BACKUP   
     interface eth0         #實例綁定的網卡   
     virtual_router_id 51   #標記(0...255)   
     priority 100           #優先級,另一台改為90   
     advert_int 1           #檢查間隔,默認1s   
     nopreempt              #不搶占,只在優先級高的機器上設置即可,優先級低的機器不設置   
     authentication {       #認證   
     auth_type PASS         #認證的方式,支持PASS和AH   
     auth_pass 1111         #認證的密碼   
     }   
     virtual_ipaddress {    #指定漂移地址(VIP)   
     192.168.16.200         #如果有多個VIP,繼續換行填寫   
     }   
     }   
       
virtual_server 192.168.16.200 80 {  #設置VIP port   
     delay_loop 2           #每個2秒檢查一次real_server狀態   
     lb_algo wrr            #LVS調度算法   
     lb_kind DR             #LVS集群模式   
     persistence_timeout 60 #會話保持時間   
  
     protocol TCP           #使用協議TCP或者UDP   
       
     real_server 192.168.16.253 80 {   
     weight 3               #權重   
#    notify_down "/root/realserver.sh start"  #檢測到服務down後執行的腳本   
     TCP_CHECK {            #tcp健康檢查   
     connect_timeout 10     #連接超時時間   
     nb_get_retry 3         #重連次數   
     delay_before_retry 3   #重連間隔時間   
     connect_port 80        #健康檢查端口   
     }   
     }   
     real_server 192.168.16.252 80 {   
     weight 3               #權重   
#    notify_down "/root/realserver.sh start"  #檢測到服務down後執行的腳本   
     TCP_CHECK {   
     connect_timeout 10     #連接超時時間   
     nb_get_retry 3         #重連次數   
     delay_before_retry 3   #重連間隔時間   
     connect_port 80        #健康檢查端口   
     }
Copyright © Linux教程網 All Rights Reserved