|
Home > Archive > Perlbal > December 2007 > Using a Selector
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| J Davis 2007-12-11, 1:11 pm |
| Hello,
I'm trying to configure both a reverse_proxy service and a web server
service on the same perlbal instance.
I want to use URL matching to determine which URL's get served by the
reverse_proxy and which get served by the web_server.
By looking at the documentation and some example configurations I can see
that this type of setup probably involves creating a selector service and by
digging through the mail archives I found a link to a "Urlmatch.pm" plugin
but I can't find any documentation on how to configure perlbal to tie all of
this together. Below is a partial example of how I think this might work but
I don't have any idea how to tell urlmatch how to work.
Any pointers or examples would be greatly appreciated.
Thanks,
-Jake
--- conf ---
LOAD Urlmatch
CREATE SERVICE match
SET listen = 0.0.0.0:80
SET role = selector
SET plugins = urlmatch
...???...
ENABLE match
CREATE POOL dynamic
SET nodefile = /etc/perlbal/nodelist.dat
CREATE SERVICE balancer
SET listen = 0.0.0.0:8001
SET role = reverse_proxy
SET pool = dynamic
SET persist_client = on
SET persist_backend = on
SET verify_backend = on
ENABLE balancer
CREATE SERVICE docs
SET listen = 0.0.0.0:8002
SET role = web_server
SET docroot = /usr/share/doc/
SET dirindexing = 1
SET persist_client = on
ENABLE docs
| |
| Jeremy James 2007-12-11, 7:11 pm |
| J Davis wrote:
> I'm trying to configure both a reverse_proxy service and a web server
> service on the same perlbal instance.
> I want to use URL matching to determine which URL's get served by the
> reverse_proxy and which get served by the web_server.
> By looking at the documentation and some example configurations I can
> see that this type of setup probably involves creating a selector
> service and by digging through the mail archives I found a link to a "
> Urlmatch.pm <http://Urlmatch.pm>" plugin but I can't find any
> documentation on how to configure perlbal to tie all of this together.
Urlmatch (as hosted on jeremy.publication.org.uk) is largely deprecated
by the official Vpath(s) plugin included in 1.60 - I believe it offers
the same functionality (although uses a straightforward regexp matching
instead of my slightly funky apache-style url matching).
> Below is a partial example of how I think this might work but I don't
> have any idea how to tell urlmatch how to work.
> Any pointers or examples would be greatly appreciated.
> ...snip...
You shouldn't normally need to specify a listen address for each
service, unless that's behaviour you explicitly want...
I'd imagine something like (not tested!):
-- start of perlbal.conf --
LOAD vpath
# Or move these into a seperate nodelist file
CREATE POOL apache_backends
POOL apache_backends ADD 192.168.1.40
POOL apache_backends ADD 192.168.1.41
POOL apache_backends ADD 192.168.1.42
CREATE SERVICE apache_proxy
SET role = reverse_proxy
SET pool = apache_backend
SET persist_backend = on
SET verify_backend = on
ENABLED apache_proxy
CREATE SERVICE local_images
SET role = web_server
SET docroot = /var/imageroot/
SET dirindexing = 0
ENABLE local_images
CREATE SERVICE mainselector
SET listen = 0.0.0.0:80
SET role = selector
SET plugins = vhost
VPATH /images/.* = local_images
VPATH .* = apache_proxy
ENABLE mainselector
-- end of perlbal.conf --
Note that images would be served from the docroot, ie. you are accessing
files under a directory at /var/imageroot/images/ - perhaps a update to
vpath will allow chopping prefixes off URLs? (hint hint)
Also, note that you can't officially have multiple selectors chained
together (ie. a vhost selector going on to a vpath selector). However, I
have a posted a patch to this list that allows you to do this (dated
25th April '07 with the title 'Patches: Chained Selectors and Multiple
Listen'). We have been using this on a medium-loaded server since
posting that without issues.
Best wishes,
Jeremy
| |
| J Davis 2007-12-11, 7:11 pm |
| Beautiful! That's exactly what I needed.
Thank you very much.
-Jake
On Dec 11, 2007 12:56 PM, Jeremy James <jbj@forbidden.co.uk> wrote:
> J Davis wrote:
>
> Urlmatch (as hosted on jeremy.publication.org.uk) is largely deprecated
> by the official Vpath(s) plugin included in 1.60 - I believe it offers
> the same functionality (although uses a straightforward regexp matching
> instead of my slightly funky apache-style url matching).
>
>
>
> You shouldn't normally need to specify a listen address for each
> service, unless that's behaviour you explicitly want...
>
> I'd imagine something like (not tested!):
>
> -- start of perlbal.conf --
>
> LOAD vpath
>
> # Or move these into a seperate nodelist file
> CREATE POOL apache_backends
> POOL apache_backends ADD 192.168.1.40
> POOL apache_backends ADD 192.168.1.41
> POOL apache_backends ADD 192.168.1.42
>
> CREATE SERVICE apache_proxy
> SET role = reverse_proxy
> SET pool = apache_backend
> SET persist_backend = on
> SET verify_backend = on
> ENABLED apache_proxy
>
> CREATE SERVICE local_images
> SET role = web_server
> SET docroot = /var/imageroot/
> SET dirindexing = 0
> ENABLE local_images
>
> CREATE SERVICE mainselector
> SET listen = 0.0.0.0:80
> SET role = selector
> SET plugins = vhost
>
> VPATH /images/.* = local_images
> VPATH .* = apache_proxy
> ENABLE mainselector
>
> -- end of perlbal.conf --
>
> Note that images would be served from the docroot, ie. you are accessing
> files under a directory at /var/imageroot/images/ - perhaps a update to
> vpath will allow chopping prefixes off URLs? (hint hint)
>
> Also, note that you can't officially have multiple selectors chained
> together (ie. a vhost selector going on to a vpath selector). However, I
> have a posted a patch to this list that allows you to do this (dated
> 25th April '07 with the title 'Patches: Chained Selectors and Multiple
> Listen'). We have been using this on a medium-loaded server since
> posting that without issues.
>
> Best wishes,
> Jeremy
>
>
|
|
|
|
|