Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been trying for the last couple of days to get this small (i though) scenario working.

Small drawing of my architecture.

      request
         |
     ApacheLB
         |
    |---------|
 Apache1   Apache2
 Tomcat1   Tomcat2

So far i can get the following to work, either serving my cluster of Apache servers or serving my cluster of Tomcat servers.

The Apache cluster handles PHP sites and uses sticky sessions (works like a charm) and the Tomcat cluster handles JPS sites and this works as well.

What i need is when an request hits my load balancer (ApacheLB) and the host requested begins with say "admin" then the Tomcat cluster takes over other request handles by the Apache cluster.

Both clusters uses handles multiple sites. Some examples.

http://www.company1.com
http://admin.company1.com

http://www.company2.com
http://admin.company2.com

I´m using Apache 2.4, Tomcat 7, mod_proxy_balancer, all under Windows.

My config.

Apache LB
<VirtualHost *:80>
Header add Set-Cookie "BALANCEID=lb.%{BALANCER_WORKER_ROUTE}e; path=/;" env=BALANCER_ROUTE_CHANGED

ProxyRequests Off
ProxyPreserveHost On

ProxyPass /balancer-manager !
ProxyPass / balancer://lb/ stickysession=BALANCEID nofailover=Off
ProxyPassReverse / http://windows-server1:8009/
ProxyPassReverse / http://windows-server2:8009/

<Proxy balancer://lb>
    BalancerMember http://windows-server1:8009/  route=node1 min=3 max=5
    BalancerMember http://windows-server2:8009/  route=node2
    ProxySet lbmethod=byrequests
</Proxy>

<Location /balancer-manager>
    SetHandler balancer-manager
    AuthType Basic
    AuthName "Balancer Manager"
    AuthUserFile "C:/etc/lb/conf/.htpasswd"
    Require valid-user
</Location>

</VirtualHost>

Host
<VirtualHost *:8009>
DocumentRoot "c:/etc/www/test"
ServerName www.company1.com
ServerAlias company1.com

<Directory "c:/etc/www/www.company1.com">
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Require all granted
</Directory>

</VirtualHost>

Any help would be great! Thanks!

Best regards Robert

share|improve this question
    
Are you looking to route requests to apache OR to tomcat depending upon uri in the request? –  mahnsc Jan 21 '13 at 14:02
    
Hi @mahnsc, thats right, depending on URI (host) request should be handled by either the Apache cluster or the Tomcat cluster. –  Robert Jan 21 '13 at 14:48
    
"Solved" it by creating to load balancer on different ports, handled by DNS. –  Robert Jan 23 '13 at 14:56
    
If anyone comes up with a better solution im all ears. –  Robert Jan 23 '13 at 14:56

1 Answer 1

From the comments

Solved" it by creating to load balancer on different ports, handled by DNS.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.