Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
    
Comeon! Noone? This is one of the most basic squid configs, nobody implemented it? A basic explanation of the architecture of the cache hierarchy (or a cat) would be fine too, the squid docs are so simple that I'm sure I'm missing something very basic. –  V. Romanov Nov 13 '12 at 12:56
1  
Not knowing how to help you, I have to ask (just as an alternate solution). Do you really need two servers for load balancing? Can one server handle the load? If that is the case, you can implement the resiliency in some other way. Keepalived + DRBD-replicated cache for example. –  chutz Nov 14 '12 at 1:07

1 Answer 1

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.

acl dvr1_cache_it_best_tv_com dstdomain www.yourdomain.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 dvr1_cache_it_best_tv_com
cache_peer_access Proxy_squid2_it_best_tv_com allow dvr1_cache_it_best_tv_com
http_port 8081 accel defaultsite=www.yourdomain.com

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:

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 dvr1.origin.it.best-tv.com parent 80 0 no-query originserver name=Proxy_dvr1_origin_it_best_tv_com

Lastly, you may try to use the proxy-only option on both proxy cache_peer definitions.

I hope that helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.