keepalived+nginx实现 HA与负载均衡中keepalived负责实现HA功能,控制VIP(虚拟网络地址)转移功能,nginx实现对realserver七层负载均衡功能,nginx提供代理服务和cache功能,DNS服务可以负责前段VIP的负载均衡。

keepalived的配置 192.168.200.1 keepalived配置 ! Configuration File for keepalived
global_defs { notification_email { xxx@xxx.com } notification_email_from xxx@xxx.com smtp_server 127.0.0.1 smtp_connect_timeout 30 router_id LVS_TEST_YDQ }
vrrp_instance VI_1 { state MASTER interface eth0 virtual_router_id 61 priority 150 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.200.101/24 dev eth0 label eth0:0 } }
vrrp_instance VI_2 { state BACKUP interface eth0 virtual_router_id 62 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 2222 } virtual_ipaddress { 192.168.200.102/24 dev eth0 label eth0:1 } }
vrrp_instance VI_3 { state BACKUP interface eth0 virtual_router_id 63 priority 50 advert_int 1 authentication { auth_type PASS auth_pass 3333 } virtual_ipaddress { 192.168.200.103/24 dev eth0 label eth0:1 } }
|