keepalived_lvs_conf.idc

keepalived.conf

! Configuration File for keepalived
 
# Update: 2013-09-10 mysyncLBIDC
 
global_defs {
#   notification_email {
#     longber@gmail.com
#   }
#   notification_email_from longber@gmail.com
#   smtp_server smtp.google.com
#   smtp_connect_timeout 30
    router_id mysyncLB1IDC
}
 
# instance VI_1
# ------------------------------------------------------------------------------
vrrp_instance VI_1 {
    state BACKUP
    priority 200
    virtual_router_id 100
    interface eth0
    lvs_sync_daemon_interface eth0
    track_interface {
        eth0
    }
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass mysyncLVSidc
    }
    virtual_ipaddress {
        192.168.0.53/24 dev eth0 label eth0:0
        192.168.0.54/24 dev eth0 label eth0:1
        192.168.0.55/24 dev eth0 label eth0:2
        192.168.0.56/24 dev eth0 label eth0:3
        192.168.0.57/24 dev eth0 label eth0:4
        192.168.0.58/24 dev eth0 label eth0:5
        192.168.0.59/24 dev eth0 label eth0:6
        192.168.0.60/24 dev eth0 label eth0:7
        192.168.0.61/24 dev eth0 label eth0:8
        192.168.0.62/24 dev eth0 label eth0:9
        192.168.0.63/24 dev eth0 label eth0:10
    }
    nopreempt
}

include enabled/*.conf

enabled/http.conf

# Update: 2013-09-10
# HTTPsession
# ------------------------------------------------------------------------------
virtual_server_group VSG_HTTPsession {
    192.168.0.53 80
}
virtual_server group VSG_HTTPsession {
    delay_loop 6
    lb_algo wlc
    lb_kind DR
    persistence_timeout 65
    protocol TCP
    ha_suspend
    #virtualhost 192.168.0.45
    sorry_server 192.168.0.46 80
    real_server 192.168.0.45 80 {
        weight 1
        TCP_CHECK {
            connect_port 80
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    } # end real_server
} # end virtual_server
# ------------------------------------------------------------------------------
 
# HTTP
# ------------------------------------------------------------------------------
virtual_server_group VSG_HTTP {
    192.168.0.54 80
    192.168.0.55 80
    192.168.0.56 80
}
virtual_server group VSG_HTTP {
    delay_loop 6
    lb_algo wlc
    lb_kind DR
    persistence_timeout 65
    protocol TCP
    ha_suspend
    #virtualhost 192.168.0.45
    sorry_server 192.168.0.46 80
    real_server 192.168.0.45 80 {
        weight 1
        TCP_CHECK {
            connect_port 80
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    } # end real_server
 
    real_server 192.168.0.46 80 {
        weight 1
        TCP_CHECK {
            connect_port 80
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    } # end real_server
} # end virtual_server
# ------------------------------------------------------------------------------

enabled/5500.conf

# Update: 2013-11-19
# VT(HTTP),x.x.x.191:5500
# ------------------------------------------------------------------------------
virtual_server 192.168.0.54 5500 {
    delay_loop 6
    lb_algo wlc
    lb_kind DR
    persistence_timeout 65
    protocol TCP
    ha_suspend
    #virtualhost 192.168.0.54
    sorry_server 192.168.0.46 5500
    real_server 192.168.0.45 5500 {
        weight 1
        TCP_CHECK {
            connect_port 5500
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    } # end real_server
  
    real_server 192.168.0.46 5500 {
        weight 1
        TCP_CHECK {
            connect_port 5500
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    } # end real_server
} # end virtual_server 192.168.0.54:5500

# websocket(TCP)
# x.x.x.190:5500->192.168.0.60:8080->192.168.0.150/151:8080
# ------------------------------------------------------------------------------
virtual_server 192.168.0.60 8080 {
    delay_loop 6
    lb_algo rr
    lb_kind TUN
    persistence_timeout 120
    protocol TCP
    ha_suspend
    #virtualhost 192.168.0.60
    sorry_server 192.168.0.150 8080

    real_server 192.168.0.150 8080 {
        weight 1
        TCP_CHECK {
            connect_port 8080
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    } # end real_server
    real_server 192.168.0.151 8080 {
        weight 1
        TCP_CHECK {
            connect_port 8080
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    } # end real_server
} # end virtual_server 192.168.0.60:8080
# ------------------------------------------------------------------------------