- 论坛徽章:
- 0
|
5可用积分
本帖最后由 zfyp2003 于 2012-08-27 17:48 编辑
架构为keepalived+haproxy
我的真实IP地址为
WEB_1:192.168.1.211
WEB_2:192.168.1.213
负载主机:192.168.1.212
VIP:192.168.1.214
我的keepalived.conf内容为- vrrp_script chk_haproxy {
- script "killall -0 haproxy"
- interval 2
- weight 2
- }
- vrrp_instance VI_1 {
- interface eth0
- state MASTER
- virtual_router_id 51
- priority 100
- virtual_ipaddress {
- 192.168.1.214
- }
- track_script {
- chk_haproxy
- }
- }
复制代码 haproxy.cfg- global
- log 127.0.0.1 local0
- log 127.0.0.1 local1 notice
- maxconn 4096
- user haproxy
- group haproxy
- defaults
- log global
- mode http
- option httplog
- option dontlognull
- retries 3
- option redispatch
- maxconn 2000
- contimeout 5000
- clitimeout 50000
- srvtimeout 50000
- listen Nginx_Server 192.168.1.214:80
- mode http
- stats enable
- stats auth admin:password
- balance roundrobin
- cookie JSESSIONID prefix
- option httpclose
- option forwardfor
- option httpchk HEAD /check.text HTTP/1.0
- server Nginx_Web_1 192.168.1.211:80 cookie A check
- server Nginx_Web_1 192.168.1.213:80 cookie B check
复制代码 启动keepalived之后用ip addr查看 显示如下- 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
- link/ether 00:0c:29:a3:48:b8 brd ff:ff:ff:ff:ff:ff
- inet 192.168.1.212/24 brd 192.168.1.255 scope global eth0
- inet 192.168.1.214/32 scope global eth0
- inet6 fe80::20c:29ff:fea3:48b8/64 scope link
- valid_lft forever preferred_lft forever
复制代码 inet 192.168.1.212/24 brd 192.168.1.255 scope global eth0
inet 192.168.1.214/32
红字部分为什么不一样?不在同一子网?
|
|