haproxy+keepalived

global_defs {
    router_id LVS_DEVEL
}
vrrp_script chk_haproxy {   
    script "killall -0 haproxy"     
    interval 1     
    weight -2  
}
vrrp_instance VI_1 {   
    state MASTER     
    interface eth0    
    virtual_router_id 51     
    priority 100  
    advert_int 1    
    authentication {    
        auth_type PASS    
        auth_pass 876543    
    }    
    virtual_ipaddress {    
        10.99.0.189  
    }    
    track_interface {    
        eth0    
    }    
    track_script {    
        chk_haproxy    
    }    
}

  

global_defs {
    router_id LVS_DEVEL
}
vrrp_script chk_haproxy {   
    script "killall -0 haproxy"     
    interval 1     
    weight -2  
}
vrrp_instance VI_1 {   
    state BACKUP
    interface eth0    
    virtual_router_id 51     
    priority 99  
    advert_int 1    
    authentication {    
        auth_type PASS    
        auth_pass 876543    
    }    
    virtual_ipaddress {    
        10.99.0.189  
    }    
    track_interface {    
        eth0    
    }    
    track_script {    
        chk_haproxy    
    }    
}

  

global
    daemon
    maxconn 256

defaults
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

#管控项目前后端配置------------------------------------------------------------
listen SGGK-APP 0.0.0.0:9030 
    balance   roundrobin
    stats     refresh 2
    option    httpchk GET /CslaWsHttpPortal
    server    APP160 10.99.0.160:8030 check
    server    APP161 10.99.0.161:8030 check
    server    APP181 10.99.0.181:8030 check
#------------------------------------------------------------

#铁区MES前后端配置------------------------------------------------------------
listen TQMES-APP 0.0.0.0:9130   
    stats     refresh   2
    balance   roundrobin    
    option    httpchk GET /CslaWsHttpPortal 
    server    APP170 10.99.0.170:8030 check 
    server    APP180 10.99.0.180:8030 check
#------------------------------------------------------------

#状态监控画面(访问http://host:1936即可)------------------------------------------------------------
listen stats *:1936
    stats enable
    stats uri /
    stats hide-version 

  

原文地址:https://www.cnblogs.com/zhahost/p/5991147.html