Search squid archive

Re: how to use accel url_rewrite_program urlgroup and cache_peer?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Todd,

Todd Harris a écrit :
Hi Sylvain -

I'm working to do the exact same thing that you are, although I'm jumping right from 2.4 to 3.0PRE which has some nice features for load-balancing.

I'm also interested in using ACLs over an external redirector. But I see from your current config you are still using a redirector to rewrite your URLs.

The problem I see it with trying to use acls entirely is that you have to specifically allow/deny for all aspects of a site. This can become cumbersome with a bunch of machines that handle different tasks. But it's trivial with a redirector.

Yes, I'm still using the redirector. I posted the my self reply just to match my initial post subject. I will try to remove it, because the rewriting or more precisely the URL handling is done on the origin server side.

I think squid will perform better than simple perl script especially when you have a config variable:
#  TAG: url_rewrite_concurrency
#       The number of requests each redirector helper can handle in
#       parallel. Defaults to 0 which indicates that the redirector
#       is a old-style singlethreaded redirector.

And you're right, acl must be duplicated and excluded for each peer, as I've found until now. May I will use a config generator, which wont be so disturbing as I must control some other config from here too.

Another post which may help squid admin rewriter :
Subject :  url rewrite problem
http://www.mail-archive.com/squid-users@xxxxxxxxxxxxxxx/msg49741.html

Which also show up rewriter config statement in squid 2.6.


Todd, what do you mean by "3.0PRE which has some nice features for load-balancing"?
Could you point me some URL?

Is it stable enough for production?

Regards,
Sylvain.
On Oct 2, 2007, at 6:12 AM, Sylvain Viart wrote:

Hi,

Chris Robertson a écrit :
incomming URL: somedomaine/path/script.php => should go to peer which host script, php incomming URL: somedomaine/imagepath/someimg.jpg => should go to static peer, filer

So I've a redirector which analyze the URL based on some regexp. It was needed for 2.5. Because the redirector script was embedding the round robbing balancing algorithm. I don't find any good doc on how to use all those rewriting url + peer balancing etc. Can someone point me to some good ref?

http://wiki.squid-cache.org/SquidFaq/ReverseProxy#head-7bd155a1a9919bda8ff10ca7d3831458866b72eb
Thanks Chris for the link, but I've found this one, and if didn't fit my need.

I've found by myself.

Here's one solution, for squid Version 2.6.STABLE5:

# put squid in accelerator mode
http_port 80 defaultsite=my.site.com vhost

# some peer (backends/origin server)
# here round robin same weight, you can have lot more server if needed. found in the FAQ URL above. cache_peer php-01 parent 80 0 no-query originserver round-robin weight=1 login=PASS cache_peer php-02 parent 80 0 no-query originserver round-robin weight=1 login=PASS

# + the filer for static content, I add another peer for content filtering
cache_peer filer-01 parent 80 0 no-query originserver name=filergrp

# the redirector, next I will try to remove it and use squid regexep
# it receives and returns the following content: (from cache.log debug enabled)
# helperSubmit: http://my.site.com/img/file.jpg IP/domain - GET -
# helperHandleRead: '!filer! http://filer-01/img/file.jpg IP/domain - GET -
# it uses the urlgroup to tag the url, here : filer
url_rewrite_program /etc/squid/redirector.pl

# some parameter to config the redirector, here 5 process
url_rewrite_children 5
# which don't know how to handle concurrency
url_rewrite_concurrency 0
# we need to keep the host header not to be rewrote by squid (vhosts name based)
url_rewrite_host_header off

# one acl for matching the tag urlgroup done by the redirector
acl static_doc urlgroup filer

# filtering to originserver based on acl tagged url
# static_doc (tagged by urlgroup by the redirector + the acl) are allowed on the filer peer server, nothing else
cache_peer_access filergrp allow static_doc
cache_peer_access filergrp deny all

# static content are note allowed on backend pool, but all other content, no tagged as static will be load balanced here.
cache_peer_access php-01 deny static_doc
cache_peer_access php-02 deny static_doc

sounds working for me, it also includes some more acl but not related to accelerator mode reverse proxy.

Here it is.
I may update the wiki because of the lact of documentation using the urlgroup behavior, also the doc in acl seems wrong:

http://www.squid-cache.org/Versions/v2/2.6/cfgman/acl.html
    acl urlgroup group1 ...
      # match against the urlgroup as indicated by redirectors
Seems to miss the acl_name part =>     acl acl_name urlgroup group1 ...
no?



[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux