[Zope] Advice needed: load balancing wih ZEO and Apache on Solaris.
Phil Harris
phil.harris@zope.co.uk
Sat, 25 Aug 2001 23:00:08 +0100
Tone,
In advance I'll say that this isn't the best way to do this, Sean Upton has
better advice, but this is a simple way to test that all works as planned.
The rewrite rules in Apache can make use of a file to do 'random' server
selections. I do this when I'm testing new ZEO services, getting them
serving in a 'round-robin' fashion.
I have a httpd.conf in work that will do exactly what you want, but I can
give you a few pointers right away.
Mail me on Monday, and I'll send you the relevant parts of my httpd.conf.
Anyway on with the show:
Take a look at this document,
http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html. Search for
'Randomised Plain Text' and there's your recipe.
Basically, you need to create a file that has these lines in, call it
map.txt (the name doesn't really matter though):
localhost port1|port2|port3
replace port1 .. port 3 with the exact ports you are using:
localhost 8080|8081|8082
You can put as many options on this line as you need.
Then change your final rewrite rule to be like this:
RewriteMap servers rnd:/path/to/file/map.txt
RewriteRule ^/(.*)
http://localhost:$(servers:localhost)/VirtualHostBase/http/myserver.ncl.ac.u
k:80/VirtualHostRoot/$1 [P]
This will put a random port number into the line thereby giving you pseudo
'round-robin' functionality. The ${servers:localhost} is the clever part,
'servers' is the name of the map, and localhost is a parameter telling the
map which line of the map.txt file to choose from.
And that's it, job done, next please....
hth
Phil
phil.harris@zope.co.uk
----- Original Message -----
From: "Tony McDonald" <tony.mcdonald@ncl.ac.uk>
To: "Zope" <zope@zope.org>
Sent: Saturday, August 25, 2001 5:13 PM
Subject: [Zope] Advice needed: load balancing wih ZEO and Apache on Solaris.
> Hi,
> I've followed the instructions at
> <http://www.zope.org/Members/dshaw/AdvancedSiteSetup> to set up a ZEO
server
> and client (on the same machine). These instructions are very clear and
I'd
> recommend them to people wanting to experiment with ZEO.
>
> We serve our content up through Apache (fast delivery of static content,
CGI
> scripts and PHP4 served too).
>
> I'm using the VHM method of routing Apache requests through to my ZServer
> installation so (only a snippet shown, and this is an example);
>
> RewriteEngine on
> RewriteRule ^/cgi-bin - [L]
> RewriteRule ^/static - [L]
> RewriteRule ^/ltsn_images - [L]
> RewriteRule ^/(.*)
>
http://localhost:18080/VirtualHostBase/http/myserver.ncl.ac.uk:80/VirtualHos
> tRoot/$1 [P]
>
> Following the instructions from Dave Shaws' page I have a ZEO server
running
> on port 8080 and a client running on port 8081
>
> One idea I've had from reading the Apache Rewrite rules page at
> <http://httpd.apache.org/docs/misc/rewriteguide.html>
> Is to use ProxyPassReverse (in some way), i.e.
>
>
> ProxyPassReverse / http://localhost:8080/
> ProxyPassReverse / http://localhost:8081/
>
>
> My question is this;
>
> What can I do to get requests from myserver.ncl.ac.uk farmed out to my ZEO
> server-client farm?
>
> Any pointers would be really appreciated.
> Cheers
> Tone.
> --
> Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/
> The Medical School, Newcastle University Tel: +44 191 243 6140
> A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )