I am setting up a Centos machine with Apache running on it for load balancing between two application webservers. Normally I would do all this with an F5 (or other hardware LB) but the customer is not wanting to spend anymore money so I am putting this together with a VM. I have gotten it to work to do regular round robin between two machines, but I need to just have the second server for failover. See my virtual host below:
<VirtualHost *:80>
Options +FollowSymLinks
Include conf/virtualhosts.conf
RewriteEngine on
RewriteLogLevel 9
RewriteLog /var/log/httpd/rewrite_log
RewriteRule ^/?h/(\.[0-9]+)/(string/.*)$ balancer://mycluster/$2?h=$1 [P,QSA]
Header add Set-Cookie "h=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_WORKER_ROUTE
<Proxy balancer://mycluster/>
Order deny,allow
Allow from all
BalancerMember http://server1:8080 route=0
BalancerMember http://server2:8080 route=1 status=+H
</Proxy>
ProxyPreserveHost on
ProxyPass / balancer://mycluster/ stickysession=h nofailover=On
ProxyPassReverse / balancer://mycluster/
ProxyPass /balancer-manager !
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Allow from all
</Location>
</VirtualHost>
Two questions now that I'm having issues with:
I have set the status=+H option, but when I turn off the web service on server1, it just keeps trying to send me over to that one. Is this because of a cookie on my machine that still wants me to go there? Do I need to set up a health check for a http return value? I'm a little lost at this point. If I take down the whole server, it should work, but then I gotta go downstairs to the server room to reboot the thing :).
I cannot get the balancer_manager to work. When I go to
http://virtualip/balancer-manager
it sends me to one of the web servers and then the web server on server1 will tell me that that link does not exist.
Any help on either issue would be great!
0 Answers