HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   Apache Loadbalancer with multiple VHosts (http://www.howtoforge.com/forums/showthread.php?t=32239)

Franck 7th March 2009 23:45

Apache Loadbalancer with multiple VHosts
 
Good evening,

First thanks for the great tutorial by Falko "Creating A Session-Aware Loadbalancer Using mod_proxy_balancer".

I have used it and it is running fine coupled with Sharedance for session management.

I have 2 questions:

1. In the balancer manager interface one can set up route Redirects in case of failover. However if the Apache load balancer restarts, the settings are lost. Is there any way of making them persistent?


2. On the 2 front end servers I have several vhost. Like this:

Server 1:
<VirtualHost *:80>
ServerName 172.18.2.40
...
</VirtualHost>
<VirtualHost *:80>
ServerName www1.example.com
...
</VirtualHost>

Server2:
<VirtualHost *:80>
ServerName 172.18.2.41
...
</VirtualHost>

<VirtualHost *:80>
ServerName www2.example.com
...
</VirtualHost>

I have balanced the 2 vhost associated with the server's local IPs addresses:
BalancerMember http://172.18.2.40:80 route=http1
BalancerMember http://172.18.2.41:80 route=http2
And it works fine. However I now would like to balance (btw still on port 80) www1.example.com and www2.exemple.com

Any suggestions?

Thanks in advance

Franck

falko 8th March 2009 17:11

Quote:

Originally Posted by Franck (Post 174027)
1. In the balancer manager interface one can set up route Redirects in case of failover. However if the Apache load balancer restarts, the settings are lost. Is there any way of making them persistent?

Not sure. Maybe one can add this directly to the Apache configuration?


Quote:

Originally Posted by Franck (Post 174027)
2. On the 2 front end servers I have several vhost. Like this:

Server 1:
<VirtualHost *:80>
ServerName 172.18.2.40
...
</VirtualHost>
<VirtualHost *:80>
ServerName www1.example.com
...
</VirtualHost>

Server2:
<VirtualHost *:80>
ServerName 172.18.2.41
...
</VirtualHost>

<VirtualHost *:80>
ServerName www2.example.com
...
</VirtualHost>

I have balanced the 2 vhost associated with the server's local IPs addresses:
BalancerMember http://172.18.2.40:80 route=http1
BalancerMember http://172.18.2.41:80 route=http2
And it works fine. However I now would like to balance (btw still on port 80) www1.example.com and www2.exemple.com

Any suggestions?

You can add this to each vhost that you want to balance.

Franck 8th March 2009 18:36

Thanks Falko

On #1 what syntax would u use? :rolleyes:

On #2, that's assuming you have DNS entries setp up (i.e. public addresses). I was wondering if you could do that just by staying on LAN and somehow loadbalance specific vhost as opposed to private IP addresses :confused:

Franck 9th March 2009 15:07

Ok #2 was pretty stupid :o on my part. I edited /etc/hosts and voila! :)

That leaves me with question #1 persistent failover load balancer settings

Thanks for any input

falko 9th March 2009 19:06

Quote:

Originally Posted by Franck (Post 174261)
That leaves me with question #1 persistent failover load balancer settings

Thanks for any input

Not sure. Maybe you can do something with the environment variables? http://httpd.apache.org/docs/2.2/mod..._balancer.html

Franck 21st March 2009 03:20

Ok I found out :)

<Proxy balancer://mycluster>
BalancerMember http://fr1.ndd.com:80 route=http1 redirect=http2
BalancerMember http://fr2.ndd.com:80 route=http2 redirect=http1
ProxySet lbmethod=byrequests
</Proxy>


All times are GMT +2. The time now is 21:19.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.