Perlbal in reverse proxy mode with an Internal DNS

53 views
Skip to first unread message

ashishpadave

unread,
Dec 22, 2011, 4:28:13 PM12/22/11
to perlbal
Hi,

I want to have multiple websites hosted on multiple webservers, but
one external IP.

Each domains www record is a CNAME pointing to foo.bar.com. There is
an internal DNS in which each domain is mapped to a particular
webserver.

So when a request hits perlbal, is it possible to query the DNS and
check if the resolved hostname is in a pool of pre-defined list of
webservers?

Varnish does this with its DNS director (
http://kristianlyng.wordpress.com/2010/08/02/varnish-backend-selection-through-dns/
), but the problem is it requires a set of pre-defined backends which
have to be IP addresses. But the internal DNS in my case is set to
resolve to an Amazon ELB hostname, which does not have fixed IP.

Thanks

Ashish

Leo Lapworth

unread,
Dec 23, 2011, 3:37:44 AM12/23/11
to per...@googlegroups.com
On 22 December 2011 21:28, ashishpadave <ashish...@gmail.com> wrote:
> I want to have multiple websites hosted on multiple webservers, but
> one external IP.

You want to use the Vhosts plugin:

in perlbal.conf

LOAD vhosts
LOAD Stats

CREATE POOL website_a_backends
SET nodefile = /etc/perlbal-website_A_webserver_ips.dat

CREATE SERVICE web_site_A_webservice
SET role = reverse_proxy
SET pool = website_a_backends
.....
ENABLE web_site_A_webservice

# This is what listens on your IP address and chooses the relevant
SERVICE for the domain
CREATE SERVICE public
SET listen = 0.0.0.0:80
SET role = selector
SET plugins = stats, vhosts

VHOST www.website-A.com = web_site_A_webservice
VHOST www.website-B.com = web_site_B_webservice
#.... list all your domains and the configs for them
VHOST * = default_webservice
ENABLE public

Hope that helps

Ashish Padave

unread,
Dec 23, 2011, 1:22:55 PM12/23/11
to perlbal
The issue is we can't use IP addresses, since Amazon ELB addresses are
not constant and they can change at any time. And hence the need to
look up an internal DNS to find out which group of servers the website
is hosted on.

Thanks

Ashish

On Dec 23, 1:37 pm, Leo Lapworth <l...@cuckoo.org> wrote:
> On 22 December 2011 21:28, ashishpadave <ashishpad...@gmail.com> wrote:
>
> > I want to have multiple websites hosted on multiple webservers, but
> > one external IP.
>
> You want to use the Vhosts plugin:
>
> in perlbal.conf
>
> LOAD vhosts
> LOAD Stats
>
> CREATE POOL website_a_backends
>     SET nodefile = /etc/perlbal-website_A_webserver_ips.dat
>
> CREATE SERVICE web_site_A_webservice
>     SET role            = reverse_proxy
>     SET pool            = website_a_backends
>     .....
> ENABLE web_site_A_webservice
>
> # This is what listens on your IP address and chooses the relevant
> SERVICE for the domain
> CREATE SERVICE public
>   SET listen          = 0.0.0.0:80
>   SET role            = selector
>   SET plugins         = stats, vhosts
>
>   VHOSTwww.website-A.com              = web_site_A_webservice
>   VHOSTwww.website-B.com              = web_site_B_webservice

Leo Lapworth

unread,
Dec 30, 2011, 8:27:41 AM12/30/11
to per...@googlegroups.com
On 23 December 2011 18:22, Ashish Padave <ashish...@gmail.com> wrote:
> The issue is we can't use IP addresses, since Amazon ELB addresses are
> not constant and they can change at any time. And hence the need to
> look up an internal DNS to find out which group of servers the website
> is hosted on.

Perlbal monitors your nodefiles, could you can have a script to update
those as required?

Leo

Reply all
Reply to author
Forward
0 new messages