25,988
社区成员




#从机
! Configuration File for keepalived
global_defs {
notification_email {
root@localhost
}
notification_email_from kaadmin@localhost
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL
vrrp_skip_check_adv_addr
vrrp_strict
vrrp_garp_interval 0
vrrp_gna_interval 0
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 51
priority 99
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
12.14.5.16
}
}
virtual_server 12.14.5.16 443 {#set up VIP and port
delay_loop 6
lb_algo rr loadbalance
lb_kind DR
nat_mask 255.255.0.0
persistence_timeout 0
protocol TCP
real_server 12.14.5.102 8012 {#8012是Nginx监听的端口
weight 1
HTTP_GET {
url {
path /
status_code 200
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
real_server 12.14.5.100 8012 {#8012是Nginx监听的端口
weight 1
HTTP_GET {
url {
path /
status_code 200
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}
#主机
! Configuration File for keepalived
global_defs {
notification_email {
root@localhost #local receiver for testing
}
notification_email_from kaadmin@localhost #sender
smtp_server 127.0.0.1#local server address
smtp_connect_timeout 30
router_id LVS_DEVEL
vrrp_skip_check_adv_addr
vrrp_strict
vrrp_garp_interval 0
vrrp_gna_interval 0
}
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 {
12.14.5.16
}
}
virtual_server 12.14.5.16 443 {
delay_loop 6
lb_algo rr loadbalance
lb_kind DR
persistence_timeout 0
protocol TCP
real_server 12.14.5.102 8012 {
weight 1
HTTP_GET {
url {
path /
status_code 200
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
real_server 12.14.5.100 8012 {
weight 1
HTTP_GET {
url {
path /
status_code 200
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}