keepalived實現LB配置


vim /etc/keepalived/keeplived.conf
! Configuration File for keepalived

global_defs {
   notification_email {
     acassen@firewall.loc
     failover@firewall.loc
     sysadmin@firewall.loc
   }
   notification_email_from Alexandre.Cassen@firewall.loc
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.17.205
    }
}
# 虛擬服務器ip和port,用於分發請求
virtual_server 192.168.17.205 80 {
    delay_loop 6
    # lvs調度算法 rr|wrr|lc|wlc|lblc|sh|dh
    lb_algo wrr 
    # lvs轉發方法
    lb_kind DR
    #persistence_timeout 50
    protocol TCP

    # 真實服務器ip和port
    real_server 192.168.17.101 80 {
        # 權重
        weight 1
        # 健康檢查
        TCP_CHECK {
            # 連接超時時間,默認5s,
            connect_timeout 3
            # 重新連接次數
            nb_get_retry 3
            # 重新嘗試連接前延遲3s
            delay_before_retry 3
            # 真實服務器port
            connect_port 80
        }
    }

    real_server 192.168.17.103 80 {
        weight 1
        TCP_CHECK {
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
            connect_port 80
        }
    }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM