lvs+keepalived keepalvied.conf配置文件
一、lvs+keepalived版本
ipvsadm v1.27(IPVS v1.2.1) keepalived-1.3.5
1、keepalived.conf 配置文件(HTTP_GET)
! Configuration File for keepalived
global_defs {
notification_email {
root@localhost
}
notification_email_from root@localhost
smtp_server localhost
smtp_connect_timeout 30
router_id LVS_DEVEL37
}
vrrp_instance VI_37 {
state MASTER
interface eth0
virtual_router_id 37
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.14.4.36
}
}
virtual_server 10.14.4.36 8080 {
delay_loop 6
lb_algo rr
lb_kind DR
protocol TCP
real_server 10.14.4.33 8080 {
weight 1
HTTP_GET {
url {
path /index.jsp
digest 809cd91d5b866cccaeeb8e6f59c25d66
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
real_server 10.14.4.34 8080 {
weight 1
HTTP_GET {
url {
path /index.jsp
digest 2768dd20eceaca05f05950eb1f588036
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}
# 获取index.jsp页面,digest值:
/usr/bin/genhash -s 10.14.4.33 -p 8080 -u /index.jsp /usr/bin/genhash -s 10.14.4.34 -p 8080 -u /index.jsp
2、keepalived.conf 配置文件(TCP_CHECK)
! Configuration File for keepalived
global_defs {
notification_email {
root@localhost
}
notification_email_from root@localhost
smtp_server localhost
smtp_connect_timeout 30
router_id LVS_DEVEL37
}
vrrp_instance VI_37 {
state MASTER
interface eth0
virtual_router_id 37
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.14.4.36
}
}
virtual_server 10.14.4.36 8080 {
delay_loop 6
lb_algo rr
lb_kind DR
protocol TCP
real_server 10.14.4.33 8080 {
weight 1
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connect_port 8080
}
}
real_server 10.14.4.34 8080 {
weight 1
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connect_port 8080
}
}
}

浙公网安备 33010602011771号