You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tom Evans <te...@googlemail.com> on 2008/08/20 12:57:13 UTC
[users@httpd] Configuring mod_proxy_balancer with failover to hot standby
Hi all.
I'm trying to setup a reverse proxy with failover to a hot standby using
mod_proxy_balancer. This works perfectly when all application servers
are functioning correctly, and the reverse proxy correctly fails over to
the hot standby if the http service on the primary application server
fails.
Where I'm having difficulty is working out how to get httpd to mark a
particular application server as 'broken', when it cannot get access to
a required resource (in this case, if the database server has failed).
The reverse proxy is httpd 2.2.8 (event MPM), and the application
servers are httpd 2.2.8 (worker MPM) with mod_fastcgid, connected to a
python fastcgi application. The OS in all cases is FreeBSD 7.
Here is my configuration:
<VirtualHost *:80>
ServerName foobar
DocumentRoot "/var/empty"
<Proxy balancer://idp-cluster>
BalancerMember http://foo:5501
BalancerMember http://bar:5501 status=+H
</Proxy>
ProxyPass /balancer !
ProxyPass / balancer://idp-cluster/
ProxyPassReverse / http://foo/
ProxyPassReverse / http://bar/
<Location /balancer>
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from 10.
</Location>
</VirtualHost>
The only way I can think to do this is to have some sort of heartbeat
service which monitors the resources each app server requires, and
disable the appropriate app server, or similarly to disable the app
server from the app itself if it cannot access the DB.
This seems a little messy. Is there any way to signify from the
application server, via response headers, to say "I'm bust, please stop
using me"?
Cheers
Tom
Re: [users@httpd] Configuring mod_proxy_balancer with failover to hot standby
Posted by Rob Stewart <ro...@googlemail.com>.
> This seems a little messy. Is there any way to signify from the
> application server, via response headers, to say "I'm bust, please stop
> using me"?
>
This isn't what you're asking for, but it might be useful to you, so
here goes...
If you go to the '/balancer' URL for your balancer manager you'll
see a nice little cluster manager page that allows you to enable and
disable the nodes in your cluster. You can also enable or disable
nodes too from that page and if you're clever you can analyse the
request the form makes when you do this.
I use this (and 'curl') to tell the Apache side of things when a
node is down on my server...
curl "http://127.0.0.1/balancer?b=cluster&w=http://127.0.0.1:8080&dw=Disable"
You'll need to adjust your cluster name (the b parameter) and the IP
and port, or course. To say the node is up is the same, but the dw
parameter is changed to 'Enable'.
--
Rob (rob.rstuff@googlemail.com)
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org