Using Perlbal to Proxy to Multiple Back-end Servers Based on URL

39 views
Skip to first unread message

bergbrains

unread,
Apr 21, 2011, 4:45:03 PM4/21/11
to perlbal
I've been trying to find out whether it's possible to have Perlbal
front multiple back-end servers. I've got an apache cluster that is
running mod_perl and also proxying to numerous (50) back-end
individual servers and clusters of servers (WebLogic, straight HTTP,
JBoss, etc.) based on the URL.

I have not found how to use Perlbal to route requests to different
pools/services based on the path of the URL. Is this possible? Any
pointers to how to do this?

For instance, /foo may proxy to one HTTP server, and /bar may load
balance two or three servers. I'm also using mod_rewrite's proxying
ability to munge URLs and proxy to a single back-end server, but I
haven't seen how to do any of this with Perlbal.

Am I barking up the wrong tree?

Thanks.

Eric

Mark Smith

unread,
Apr 21, 2011, 5:36:30 PM4/21/11
to per...@googlegroups.com
> I have not found how to use Perlbal to route requests to different
> pools/services based on the path of the URL. Is this possible? Any
> pointers to how to do this?

You have to use the plugin Vpaths -- check it out:

http://cpansearch.perl.org/src/DORMANDO/Perlbal-1.78/lib/Perlbal/Plugin/Vpaths.pm

The config looks like this:

http://cpansearch.perl.org/src/DORMANDO/Perlbal-1.78/conf/virtual-hosts.conf

That one is for the Vhost plugin, but Vpath is similar. Instead of using VHOST commands, you would use VPATH, like this:

VPATH ^/foo$ = foo_service
VPATH ^/bar$ = bar_service

The only suggestion I would have is that you also set a default_service on the selector service. For example, you probably will have something like this:

CREATE SERVICE vdemo
SET listen = 0.0.0.0:80
SET role = selector
SET plugins = vhosts
SET persist_client = on
SET default_service = default_service

VPATH ^/foo$ = foo_service
VPATH ^/bar$ = bar_service
ENABLE vdemo

That way, if nothing matches your paths, it will fall back to the default service.

Let us know if you have any more questions. Good luck!


--
Mark Smith
ma...@qq.is

Reply all
Reply to author
Forward
0 new messages