I have setup a load balancer with Apache 2.2 via mod_proxy and mod_proxy_balancer. The load balancing works just fine, but there is one case I cannot find any configuration options for, namely, while using persistent connections to the backend servers, when one of them dies (shuts down, crashes, etc ), the existing connections to it still try to access it. Is there a way to configure the apache Load Balancer so that it quits or recreates connections to dead backend servers? In the LVS world the Ldirector has an option under Proc FS that governs just that:
/proc/sys/net/ipv4/vs/expire_quiescent_template
When this is set persisten sessions / connections ot a dead backend server will be flushed so that on the next client request they can be recreated.
Is there something similar to it in the Apache world?
Thanks in adavnce!
Cheers, Konstantin Boyanov
P.S. In what manner does Apache check the status of the backend servers? Does it try to connect to some port or something like that? It would be great if someone can shed some ligjt on that too!
Here is my virtual host configuration file:
ServerAdmin admin@mysite.com ServerName myapp.mysite.com
DocumentRoot /srv/www/vhosts/myapp.mysite.com
ErrorLog /var/log/apache2/myapp.mysite.com-error_log
CustomLog /var/log/apache2/myapp.mysite.com-access_log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
ScriptAlias /cgi-bin/ "/srv/www/vhosts/myapp.mysite.com/cgi-bin/"
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from all
</Location>
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from bmf.intern.netz
</Location>
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy balancer://myapp>
BalancerMember http://172.22.1.133:777/ loadfactor=10 route=1 connectiontimeout=200ms
BalancerMember http://172.22.1.134:777/ loadfactor=10 route=2 connectiontimeout=200ms
ProxySet stickysession=ROUTEID
ProxySet lbmethod=byrequests
</Proxy>
ProxyPass /balancer-manager !
ProxyPass /server-status !
ProxyPass / balancer://myapp/ lbmethod=byrequests
ProxyPassReverse / balancer://myapp/
<Directory "/srv/www/vhosts/myapp.mysite.com/cgi-bin">
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>
<IfModule mod_userdir.c>
UserDir public_html
Include /etc/apache2/mod_userdir.conf
</IfModule>
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/srv/www/vhosts/myapp.mysite.com">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>