Buongiorno e grazie per l’acquisto.
Oggi configureremo un cluster di server WEB affinchè sinao in grado di bilanciare le richieste tra i componenti del cluster e garantire un certo livello di alta affidabilità.
Partiamo con gli ingredienti. Servono 3 dicasi tre server: due (presumibilmente potenti) in cluster per erogare il sito web vero e proprio ed un server (presumibilmente più piccolo) per effettuare il balancing delle richieste. Per dirla tutta sui due web server può girarci un qualsiasi server web a partire da Apache 2.0 in poi mentre sul server di balancing avremo bisogno di Apache 2.2 compilato con il supporto per il mod_proxy e mod_proxy_balancer.
Per chi non lo sapesse l’unico sistema operativo degno di essere usato è Freebsd, per cui questo how-to si appoggerà ad esso.
Per il nostro esempio definiamo i due web server come www1 (www1.site.com) e www2 (www2.site.com) mentre la macchina balancer è identificata come www (www-fw.site.com).
Innanzitutto andiamo su www, dentro /usr/ports/www/apache22 e spariamoci un bellissimo make options, all’interno del quale attiveremo tutti i mod_proxy, seguito da un make install che frullerà per parecchi minuti.
cd /usr/ports/www/apache22
make options
make install
A questo punto modifichiamo l’httpd.conf dentro /usr/local/etc/apache22 aggiungendo le seguenti righe:
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/ stickysession=BALANCEID nofailover=On
ProxyPassReverse / http://www1.site.com/
ProxyPassReverse / http://www2.site.com/
<Proxy balancer://mycluster>
BalancerMember http://www1.site.com route=www1
BalancerMember http://www2.site.com route=www2
ProxySet lbmethod=byrequests
</Proxy>
<Location /balancer-manager>
SetHandler balancer-manager
Order deny,allow
Allow from all
</Location>
A questo punto dentro /etc/rc.conf io suggerisco di attivare lo startup di apache22 al boot e di htcacheclean che fa la pulizia della directory di cache del proxy:
apache22_enable=”YES”
htcacheclean_enable=”YES”
Ok, il balancer è pronto, ora dobbiamo semplicemente istruire i web server affinché in fase di erogazione dei contenuti venga specificato il COOKIE che permette al balancer di riassociare un client al suo server. Dentro l’httpd.conf di ognuno dei due server web incolliamo (nel virtual host che ci interessa o nella location) il seguente codice:
RewriteEngine On
RewriteRule .* – [CO=BALANCEID:balancer.www1:site.com:1440:/]
Attenzione ad impostare correttamente il domain del cookie, il lifetime ed il path. E soprattutto attenti ad aver attivato il mod_rewrite prima di attivare la rewriteengine. E soprattutto sul secondo server cambiate www1 in www2…
Ok, restartate tutti e tre gli apache… dovrebbe funzionare.
Buon divertimento.
p.s.:
poi amplio il concetto…
Discover credit card offers
A credit reporting
Georgia loans automobile
Mortgage refinance information site map
Texas home equity loans
Card company credit report
Low credit score loans
Compare credit card offers
Online debt consolidation
Florida renters insurance
Credit immediately online report
Insurance home owner policy
Health insurance ca
Secured debt consolidation
Applications for credit cards
Disability insurance company
Uk lottery national consolidation debt
Insurance life rates
Increasing credit scores
Sub prime auto loan
Home equity loan best rate
Mortgage refinance online
Card credit debt letter settlement
Liberty mutual homeowners insurance
Insurance clinic for sexual health
Credit card debt settlements
Faxless online payday loan
California home mortgage refinance bad credit loan pay
New credit score
Credit card application form
Business credit card offer
Life insurance quotes for adult children
Debt consolidation bad credit
Visa credit card offer
Compare auto insurance
600 credit score
Torn up credit card application
Sears credit card application
American income life insurance
The best credit score
Credit cards online application
Credit card machine paper
Credit repair lawyers
Low cost life insurance
Auto insurance companies
Free credit card machine
New york life insurance
Debt consolidation loan
Illinois free credit report
Automobile insurance ratings of cars
Health insurance after cancer
Credit card offers
Ohio debt consolidation loan
Credit reporting bureau
Hartford life insurance
Student loans apply online
Auto insurance texas
Debt consolidation lender
Unsecured debt consolidation loan
Consolidation loans debt loan
Oregon home equity loan
Card credit debt pay
Bank credit card offers
American modern home insurance company
Disability insurance cost
America card credit debt
Student loan consolidation center
Consolidate student loans
Credit report.com
Transunion credit reporting agency
Bad credit student loans
California home loan mortgage rate refinance
Lower payment debt consolidation ma
Debt settlement program
Idaho home mortgage refinance
Auto insurance
Instant auto loan


