[squid-users] Accelerating Multiple Servers

From: Kent, Mr. John <kent@dont-contact.us>
Date: Fri, 13 Jul 2001 16:25:02 -0700

Greetings,

Trying to use Squid to both load share among and serve as an accelerator for
several web servers.
I can get it to accelerate one machine, I can get it to redirect requests
among several servers
in round-robin fashion, but I can't get it to cache requests made to ALL the
servers.
I've attached my squid.conf and redirect.pl file in
hopes someone can tell me how to correctly set up my squid.conf file.

The current set up only gets cache hits when the redirect sends requests to
kaui, 199.9.2.69

Thank you,

John Kent
Monterey, CA

############################################################################
########
http_port kauai.nrlmry.navy.mil:80
icp_port 0

httpd_accel_host virtual
httpd_accel_port 7777

# acl aclname src ip-address/netmask ... (clients IP address)
acl BAD_IP src 198.26.130.38 192.156.68.35 131.50.151.10
http_access deny BAD_IP

#hierarchy_stoplist /cgi-bin /sat-bin /tc-bin /~ /goes\_cc
# Since pages created dynamically by tc-bin and sat-bin have
# an expire time on them I DO want them cached - jk
hierarchy_stoplist /cgi-bin /~ /goes\_cc /coamps\-reg

acl QUERY urlpath_regex \~ dev\-bin tc\-dev Mod\-dev training cgi\-bin
sat\-dev goes\_cc cc composer coamps\-reg
no_cache deny QUERY

cache_mem 12 MB

cache_dir ufs /users/webuser/squid/cache 100 16 256
cache_access_log /users/webuser/squid/logs/access.log
cache_log /users/webuser/squid/logs/cache.log

emulate_httpd_log on

pid_filename /users/webuser/squid/logs/squid.pid

#debug_options ALL,1,28,9

#redirect_program /users/webuser/squid/etc/redirect_load_share.pl
redirect_program /users/webuser/squid/etc/redirect.pl
redirect_children 32

redirect_rewrites_host_header on

acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl acceleratedHost dst 199.9.2.69/255.255.255.255
199.9.2.33/255.255.255.255 199.9.2.92/255.255.255.255
acl acceleratedPort port 7777 8888
acl myserver src 127.0.0.1/255.255.255.255
acl SSL_ports port 443 563
acl Safe_ports port 80 81 3128 7777 8888 8080 81 443 563
acl CONNECT method CONNECT

http_access allow manager localhost
http_access allow manager myserver
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
#http_access allow all
http_access allow acceleratedHost acceleratedPort
cache_mgr kent@nrlmry.navy.mil

cache_effective_user webuser
cache_effective_group webgroup

httpd_accel_with_proxy on
httpd_accel_uses_host_header off

memory_pools on
cachemgr_passwd disable shutdown
############################################################################
#

Here is my load-sharing redirector also routes cgi processes to
a mod-perl enabled "heavy" Apache server
############################################################
#!/users/webuser/perl/bin/perl
# redirect.pl
###########################################################
$| = 1;

# Put the fully qualified DNS name for the machine on which this
# redirector is running

my($localmachine) = "kauai.nrlmry.navy.mil";
my($domain) = "nrlmry.navy.mil";
my(@SERVERS) = qw{ rossby www2 rossby www2 rossby kauai };

my(%IP) = (kauai => "199.9.2.69",
           rossby => "199.9.2.33",
           hadley => "199.9.2.43",
           www2 => "199.9.2.92",
          );

my($j) = 0;

while(<>){
  
    # Don't send cloud class pages to mod-perl server
    next if ($_ =~ /cc|composer|train|coamps/); # Don't send cloud class
to mod-perl

    #redirect to mod_perl server
    if ($_ =~ /sat\-bin|tc\-bin/){
        # Specify heavy server
        s%(:\d+)?/sat-bin%:8888/sat-bin%i && next;
        s%(\:\d+)?/tc-bin%:8888/tc-bin%i && next;
    }

} continue {
       # Step through all the available servers
        if ($j > $#SERVERS){
            $j = 0;
        }
        my($value) = $SERVERS[$j];

        if ($value eq $localmachine){
            $value = "127.0.0.1";
        }

        # Don't switch servers for wusage or coamps-reg, only on kauai
        unless($_ =~ m/cc|wusage|coamps\-reg|composer|train/){

            $j++;

            # Rotate server
            s%127\.0\.0\.1:7777%${value}:7777%i;
            s%127\.0\.0\.1:8888%${value}:8888%i;

            # When went to accelerate virtual the incoming number
            # is now Kauai's ip
            s%$IP{'kauai'}%$IP{$value}%i
        }
        print;
}

###################################################

John Kent
Monterey, CA
Received on Fri Jul 13 2001 - 17:22:35 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:01:07 MST