In una WAN di dimensioni ragguardevoli, per garantire continuità del servizio ed affidabilità, è sempre consigliato installare un sistema di Cluster in HA[1]. Data la complessità di questo tipo di configurazione o qualora non fosse possibile realizzare un sistema così complesso, può essere una buona idea configurare un ambiente di fail over con relativo load balancer. Questo tipo di configurazione garantirà agli utenti un corretto e costante utilizzo delle risorse della rete internet. Nel caso in cui il proxy 1 dovesse avere dei problemi i client andrebbero a recuperare le informazioni presenti nella cache di un'altro proxy sulla base dello schema rappresentato nella seguente immagine

I due host che eseguono l'appliance Squid effettuano il forward della richiesta verso la rete internet attraversando il firewall. Nel caso in cui uno dei due server proxy venisse a mancare (mancato funzionamento, manutenzione, upgrade software, upgrade hardware....) subentrerebbe l'host 2.
In genere i due proxy server eseguono la cache in modalità gemella e comunicano tra loro tramite il protocollo ICP, le due o più macchine che sono state adibite a fornire lo script di super Load Balancer dovranno eseguire delle configurazioni speculari. E' fondamentale la configurazione del DNS ISC Bind (http://www.isc.org/products/BIND/) che esegue la risoluzione dei nomi host
proxy1 IN A 192.168.10.4
proxy2 IN A 192.168.10.14
;
wpad IN CNAME proxy1
IN CNAME proxy2
|
il nome wpad è un nome canonico o alias per gli host proxy1 e proxy2 che, assieme al servizio Squid, eseguono anche una copia del server web Apache. Di seguito ecco le specifiche logiche del super proxy cache a due vie da realizzato in una rete geografica che può tranquillamente essere definita come WAN di medie dimensioni.

Pentium III 500 Mhz 256 Mb RAM Pentium III 500 Mhz 384 Mb RAM OS Linux (Kernel 2.4.x) OS Linux (Kernel 2.4.x) Squid appliance 2.4 St. 6 patched Squid appliance 2.4 St. 6 patched Supporto SNMP abilitato Supporto SNMP abilitato n. 1 Disco EIDE da 10 Gb 5000 RPM n. 2 Dischi EIDE da 20 Gb 7200 RPM 64 Mb di cache_mem 96 Mb di cache_mem 2524 Mb di cache su FS EXT3 2500 Mb di cache su FS EXT3 Server httpd on board Server httpd on board |
Di seguito un esempio di file proxy.pac realizzato dalla Sharp Corporation, ottimizzato per la configurazione Super proxy server in modalità load Balancer.
/*
* Super Proxy Script
*
* by SHARP Corp.
*
* Take a look at http://naragw.sharp.co.jp/sps/
* for theory and operation.
*
*/
function FindProxyForURL(url, host)
{
/* your original script here */
if( dnsDomainIs( host, "dominio.com" ) ||
dnsDomainIs( host, "love.dominio.com" ) ||
dnsDomainIs( host, "localhost" ) ||
isPlainHostName( host ) ||
isInNet( host, "127.0.0.1", "255.255.255.255" ) ||
isInNet( host, "192.168.0.0", "255.255.0.0" ) )
return "DIRECT";
else
/* end of your original script */
var n = URLhash2(url) % 2;
if (n < 1)
return "PROXY proxy2.dominio.com:3128;PROXY proxy.dominio.com:3128;DIRECT";
if (n < 2)
return "PROXY proxy.merlino.bbs:3128;PROXY proxy2.merlino.bbs:3128;DIRECT";
}
/* make check sum of URL string */
/* v1.0 by SHARP Corp Copyright 1996-1997 */
function URLhash(name)
{
var cnt=0;
var str=name.toLowerCase(name);
if ( str.length ==0) {
return cnt;
}
for(var i=0;i < str.length ; i++) {
var ch= atoi(str.substring(i,i + 1));
cnt = cnt + ch; } return cnt ;
}
/*
URLhash2( ) for directory name hash computing version.
written by SHARP Corp in Feb 1997
Objects in a same directory will be accessed via the same proxy.
Use URLhash2( ) instead of URLhash( ) if you prefer to use persistent
connection in HTTP 1.1
http://www.sharp.co.jp/sample/test/img/mebius.gif
http://www.sharp.co.jp/sample/test/img/zaurus.gif
http://www.sharp.co.jp/sample/test/img/wiz.gif
<------------------------------------->
directory name hashing here
*/
function URLhash2(name) {
var cnt=0;
var dirptr=0;
var str=name.toLowerCase(name);
if ( str.length ==0) {
return cnt;
}
/* skip filename in directory */
for(var i=str.length - 1;i >=0 ; i--) {
if ( str.substring(i,i +1) == '/' ) {
dirptr = i+1 ; break;
}
}
for(var i=0;i < dirptr; i++) {
var ch= atoi(str.substring(i,i + 1));
cnt = cnt + ch;
} return cnt ;
}
function atoi(charstring) {
if ( charstring == "a" ) return 0x61; if ( charstring == "b" ) return 0x62;
if ( charstring == "c" ) return 0x63; if ( charstring == "d" ) return 0x64;
if ( charstring == "e" ) return 0x65; if ( charstring == "f" ) return 0x66;
if ( charstring == "g" ) return 0x67; if ( charstring == "h" ) return 0x68;
if ( charstring == "i" ) return 0x69; if ( charstring == "j" ) return 0x6a;
if ( charstring == "k" ) return 0x6b; if ( charstring == "l" ) return 0x6c;
if ( charstring == "m" ) return 0x6d; if ( charstring == "n" ) return 0x6e;
if ( charstring == "o" ) return 0x6f; if ( charstring == "p" ) return 0x70;
if ( charstring == "q" ) return 0x71; if ( charstring == "r" ) return 0x72;
if ( charstring == "s" ) return 0x73; if ( charstring == "t" ) return 0x74;
if ( charstring == "u" ) return 0x75; if ( charstring == "v" ) return 0x76;
if ( charstring == "w" ) return 0x77; if ( charstring == "x" ) return 0x78;
if ( charstring == "y" ) return 0x79; if ( charstring == "z" ) return 0x7a;
if ( charstring == "0" ) return 0x30; if ( charstring == "1" ) return 0x31;
if ( charstring == "2" ) return 0x32; if ( charstring == "3" ) return 0x33;
if ( charstring == "4" ) return 0x34; if ( charstring == "5" ) return 0x35;
if ( charstring == "6" ) return 0x36; if ( charstring == "7" ) return 0x37;
if ( charstring == "8" ) return 0x38; if ( charstring == "9" ) return 0x39;
if ( charstring == "." ) return 0x2e; return 0x20;
}
|
E' necessario sottolineare che questo tipo di configurazione non garantisce comunque alcuna ridondanza e non determina nessun fattore di alta disponibilità del servizio.
| [1] |
HA è l'acronimo di High Availability che tradotto in lingua italiana significa Alta Disponibilità |