LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 596|回复: 0

LVS+keepalived+squid+nginx 无法访问问题。小菜鸟请大家帮忙

[复制链接]
发表于 2010-5-16 14:42:46 | 显示全部楼层 |阅读模式
我的架构是这样LVS+keepalived+squid+nginx
lvs1 172.16.3.196
lvs2 172.16.3.197
VIP: 172.16.3.198
squid1:172.16.3.92
squid2:172.16.3.199
nginx: 172.16.3.240
squid 可以访问到nginx,然后squid两台也绑定的ARP。现在问题是配置出来的虚拟IP172.16.3.198不能访问到nginx WEB网站.不知道是为什么。请高手解答
lvs上ipvsadm显示,也会正常的切换。
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddressort Scheduler Flags
-> RemoteAddressort Forward Weight ActiveConn InActConn
TCP 172.16.3.198:http wrr persistent 60
-> 172.16.3.92:http Route 3 0 0
-> 172.16.3.199:http Route 3 0 0
TCP 172.16.3.198:squid wrr persistent 60

keepalived配置如下
! Configuration File for keepalived

global_defs {
notification_email {
admin@163.com
}
notification_email_from admin@163.com
smtp_server 127.0.0.1
# smtp_connect_timeout 30
router_id LVS1
}

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 {
172.16.3.198

}
}

virtual_server 172.16.3.198 80 {
delay_loop 6
lb_algo wlc
lb_kind DR
persistence_timeout 60
real_server 172.16.3.92 80 {
weight 3
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connect_port 80
}
}
real_server 172.16.3.199 80 {
weight 3
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connect_port 80
}
}
}

squid配置
http_port 172.16.3.92:80 vhost vport defaultsite=172.16.3.198
cache_mem 64 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 20 MB
minimum_object_size 0 KB
maximum_object_size_in_memory 5 MB
ipcache_size 1024
ipcache_low 90
ipcache_high 95
fqdncache_size 1024

acl gsrc src 172.16.3.92 172.16.3.199 172.16.3.240 172.16.3.198 172.16.3.197 192.16.3.196
http_access allow gsrc

acl Manager proto cache_object
acl Localhost src 127.0.0.1
http_access allow Manager Localhost

acl Safe_ports port 3128 80 3130 3131 255
http_access allow !Safe_ports
http_access allow all

visible_hostname test3
cache_mgr admin@163.com

cache_effective_user squid
cache_effective_group squid
tcp_recv_bufsize 65536 bytes

cache_peer 172.16.3.199 sibling 3128 3131
cache_peer_access 172.16.3.199 allow all
cache_peer test.com parent 80 0 no-query originserver no-digest

access_log /usr/local/squid/logs/access.log
cache_dir diskd /cache 256 16 256 Q1=60 Q2=50

#error_directory /usr/local/squid/errors/Simplify_Chinese

icp_port 3130
htcp_port 0
icp_query_timeout 2000
icp_access allow all
digest_generation on
log_icp_queries on
icp_hit_stale on
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表