I want to set up 2 squid servers to act as reverse proxy and cache for a webserver on our intranet. The load balancing will be done with DNS round robin or just different mappings for different clients.
The thing is, I want both servers to try and contact each other to see if they have the object required in cache before contacting the webserver for it (the network that servers the webserver is the bottleneck and I'm trying to eliminate it)
Both squids are configured the same, here are the relevant config lines :
acl dvr1_cache_it_best_tv_com dstdomain dvr1.cache.it.best-tv.com
acl squid1_it_best_tv_com dstdomain squid1.it.best-tv.com
acl squid2_it_best_tv_com dstdomain squid2.it.best-tv.com
http_access allow dvr1_cache_it_best_tv_com
http_access allow squid1_it_best_tv_com
http_access allow squid2_it_best_tv_com
http_access allow all
http_port 8081 accel defaultsite=dvr1.cache.it.best-tv.com
cache_peer dvr1.origin.it.best-tv.com parent 80 0 no-query originserver name=Proxy_dvr1_origin_it_best_tv_com
cache_peer squid1.it.best-tv.com sibling 8081 3130 weight=10 name=Proxy_Squid1_it_best_tv_com
cache_peer squid2.it.best-tv.com sibling 8081 3130 weight=10 name=Proxy_Squid2_it_best_tv_com
cache_peer_access Proxy_dvr1_origin_it_best_tv_com allow dvr1_cache_it_best_tv_com
cache_peer_access Proxy_squid1_it_best_tv_com allow squid1_it_best_tv_com
cache_peer_access Proxy_squid1_it_best_tv_com allow squid2_it_best_tv_com
cache_peer_access Proxy_squid1_it_best_tv_com allow dvr1_cache_it_best_tv_com
cache_peer_access Proxy_squid2_it_best_tv_com allow squid1_it_best_tv_com
cache_peer_access Proxy_squid2_it_best_tv_com allow squid2_it_best_tv_com
cache_peer_access Proxy_squid2_it_best_tv_com allow dvr1_cache_it_best_tv_com
just to make it clear - dvr1.cache is the alias for the proxy servers. dvr1.origin is the web server.
Both servers work, both serve content and cache it and work fine. However, when I clear the cache on one server and then access it, it gets the content from the parent (DVR1_ORIGIN) instead of going to the sibling squid.
What did I configure wrong? Or perhaps I don't understand the architecture correctly? I read the squid manuals but as far as I see i did it all by the book and yet it doesn't work right.
Any help will be appreciated!
Have't tried this, so I can't guarantee it'll work. I just have some ideas:
First, I think acls "dstdomain" should refer to the target domain that is being served, not to the hostname of the server (dvr1.cache.it.best-tv.com). This shall probably be "it.best-tv.com", and you just need one acl object.
Second, the order of cache_peer entries matters (although I'm unsure this applies in your case). Just in case, try putting the ORIGIN peer last:
Lastly, you may try to use the proxy-only option on both proxy cache_peer definitions.
I hope that helps.