rsyslogd服务器及负载均衡

设备及规划

LBHost VIP Port RealServer 备注
192.168.0.32 192.168.0.35 TCP:514,UDP:514 192.168.0.33/34:514 test
192.168.0.28 TCP:514,UDP:514 192.168.0.33/34:1514 pre

keepalived

#! Configuration File for keepalived

# Update: 2013-04-16 SYSLOGD

global_defs {
#   notification_email {
#     my@gdu.me
#   }
#   notification_email_from my.gdu.me
#   smtp_server smtp.gdu.me
#   smtp_connect_timeout 30
   router_id RSYSLOG_LVS1
}
# ------------------------------------------------------------------------------
vrrp_instance VI_1 {
    state MASTER
    priority 200
    virtual_router_id 50
    interface eth0
    lvs_sync_daemon_interface eth0
    track_interface {
        eth0
    }
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass LOGDPass
    }
    virtual_ipaddress {
        192.168.0.35/24 dev eth0 label eth0:0
    }
    nopreempt
}

# ------------------------------------------------------------------------------
# | LBHost       | VIP           | Port              | RealServer      |
# | 192.168.0.32 | 192.168.0.35  | TCP:514,UDP:514 | 192.168.0.33/34 |
# ------------------------------------------------------------------------------
# RSYSLOG_TCP
virtual_server 192.168.0.35 514 {
    delay_loop 6
    lb_algo wlc
    lb_kind DR
    persistence_timeout 50
    protocol TCP
    ha_suspend

    real_server 192.168.0.33 514 {
        weight 1

        TCP_CHECK {
            connect_port 514
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    } # end real_server

    real_server 192.168.0.34 514 {
        weight 1

        TCP_CHECK {
            connect_port 514
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    } # end real_server

} # end virtual_server 192.168.0.35 514

# RSYSLOG_UDP
virtual_server 192.168.0.35 514 {
    delay_loop 6
    lb_algo wlc
    lb_kind DR
    persistence_timeout 50
    protocol UDP
    ha_suspend

    real_server 192.168.0.33 514 {
        weight 1
        TCP_CHECK {
            connect_port 514
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    } # end real_server

    real_server 192.168.0.34 514 {
        weight 1
        TCP_CHECK {
            connect_port 514
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    } # end real_server

} # end virtual_server 192.168.0.35 514
# ------------------------------------------------------------------------------

realserver

VIP配置

rsyslogd配置