- 论坛徽章:
- 8
|
本人在学习squid负载均衡,环境如下:
squid代理服务器IP:
eth0 192.168.1.107
eth1 192,.168.0.254
web-server1:192.168.0.1
web-server2:192.168.0.2
两台web-server上均安装apache
配置文件:
vi /etc/squid/squid.conf
http_port 80 accel vhost vport
http_port 3128
cache_peer 192.168.0.1 parent 80 0 no-query originserver round-robin name=server1
cache_peer 192.168.0.2 parent 80 0 no-query originserver round-robin name=server2
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80 8080 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access allow all
cache_dir aufs /data/squidcache 512 16 256
cache_mem 128 MB
hierarchy_stoplist cgi-bin ?
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern \.(jpg|png|gif|mp3|xml) 1440 50% 2880 ignore-reload
refresh_pattern . 0 20% 4320
然而每次访问192.168.1.107都只能访问到192.168.0.2的数据,而没有访问192.168.0.1
也就是说,无法实现轮询。
请问这是怎么回事呢,请高人指点,谢谢! |
|