Skip to content

Instantly share code, notes, and snippets.

@diablowu
Last active August 29, 2015 14:12
Show Gist options
  • Save diablowu/a29e3d2a09a9430a07fb to your computer and use it in GitHub Desktop.
Save diablowu/a29e3d2a09a9430a07fb to your computer and use it in GitHub Desktop.
LVS/DS+keepalived config file
global_defs {
notification_email {
}
notification_email_fromroot@localhost
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_sync_group VG1 {
group {
VI_1
VI_2
}
}
vrrp_instance VI_2 {
state BACKUP
interface eth0
virtual_router_id 52
priority 99
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.22.159
}
}
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 {
10.0.22.159
}
}
virtual_server 10.0.22.159 10000 {
delay_loop 15
lb_algo rr #负载算法
lb_kind DR #LVS工作模式 DS直接路由
persistence_timeout 50 #每个会话固定到后端realserver的保持时间
protocol TCP
real_server 10.0.22.151 10000 {
weight 1
TCP_CHECK {
connect_port 10000
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
real_server 10.0.22.154 10000 {
weight 1
TCP_CHECK {
connect_port 10000
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}
virtual_server 10.0.22.159 10001 {
delay_loop 15
lb_algo rr
lb_kind DR
persistence_timeout 50
protocol TCP
real_server 10.0.22.151 10001 {
weight 1
TCP_CHECK {
connect_port 10001
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
real_server 10.0.22.154 10001 {
weight 1
TCP_CHECK {
connect_port 10001
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment