Mailing List Archive

[mod_backhand-users] Question concerning mod_backhand and virtual hosts
I am trying to migrate a web server that is using server names
and IPs to implement virtual hosts.

If possible I'd like to maintain the current configuration
as much as possible and not use mod_rewrite in order to
rewrite requests to a single server.

As I understood this should be possible.

I made it to set up two servers with two IPs to serve to virtual
hosts.
Machine 1 listens to hostnames A and B and is meant to backhand
some requests (based on load) to machine 2.
If the requests are answered by machine 1 everything works fine.
However, if requests are fullfilled by the second machine
using a backhand request, they are all directed to the first
virtual host on that machine 2.

Request to Virtual Host A:
Fullfilled by Machine 1: Ok
Fullfilled by Machine 2: Ok

Request to Virtual Host B:
Fullfilled by Machine 1: Ok
Fullfilled by Machine 2: Fail: Processed like request to Virtual Host A.

The HTTP Request Header of the backhand request from machine 1 to 2
also uses "A" as "Host" and is accessing machine 2 on its "A" host
ip.

It is possible to have a configuration desribed as above?

I have included my virtual host configuration. Do you see what
mistake I made?

The backhand diagnostic page looks fine. It shows four entries with
the correct four addresses (column #4).
I have been using mod_backhand 1.2.0 with apache 1.3.19.

Thank you for any hint,

Martin

--

Machine 1:

Listen 217.65.128.25:80
<VirtualHost 217.65.128.25:80>
ServerName a
UnixSocketDir /www/logs/backhand
MultiCastStats 217.65.128.25 225.220.221.20:4445,1
AcceptStats 217.65.128.25
AcceptStats 217.65.128.26
DocumentRoot /www/htdocs/a
</VirtualHost>
<Directory /www/htdocs/a>
Backhand byAge
Backhand byLoad
</Directory>


Listen 217.65.128.75:80
<VirtualHost 217.65.128.75:80>
ServerName b
UnixSocketDir /www/logs/backhand2
MultiCastStats 217.65.128.75 225.220.221.70:4446,1
AcceptStats 217.65.128.75
AcceptStats 217.65.128.76
DocumentRoot /www/htdocs/b
</VirtualHost>
<Directory /www/htdocs/b>
Backhand byAge
Backhand byLoad
</Directory>


Machine 2:

Listen 217.65.128.26:80
<VirtualHost 217.65.128.26:80>
ServerName a
UnixSocketDir /www/logs/backhand
MultiCastStats 217.65.128.26 225.220.221.20:4445,1
AcceptStats 217.65.128.25
AcceptStats 217.65.128.26
DocumentRoot /www/htdocs/a
</VirtualHost>
<Directory /www/htdocs/a>
Backhand byAge
Backhand byLoad
</Directory>


Listen 217.65.128.76:80
<VirtualHost 217.65.128.76:80>
ServerName b
UnixSocketDir /www/logs/backhand2
MultiCastStats 217.65.128.76 225.220.221.70:4446,1
AcceptStats 217.65.128.75
AcceptStats 217.65.128.76
DocumentRoot /www/htdocs/b
</VirtualHost>
<Directory /www/htdocs/b>
Backhand byAge
Backhand byLoad
</Directory>
[mod_backhand-users] Question concerning mod_backhand and virtual hosts [ In reply to ]
On Monday, November 12, 2001, at 10:49 AM, Martin Trzaskalik wrote:
> I am trying to migrate a web server that is using server names
> and IPs to implement virtual hosts.
>
> < .. snip .. >
>
> Request to Virtual Host A:
> Fullfilled by Machine 1: Ok
> Fullfilled by Machine 2: Ok
>
> Request to Virtual Host B:
> Fullfilled by Machine 1: Ok
> Fullfilled by Machine 2: Fail: Processed like request to Virtual Host
> A.
>
> The HTTP Request Header of the backhand request from machine 1 to 2
> also uses "A" as "Host" and is accessing machine 2 on its "A" host
> ip.
>
> It is possible to have a configuration desribed as above?

Yes. Using name based virtual hosting. I do it here.

> I have included my virtual host configuration. Do you see what
> mistake I made?

Yes. Machine 1 has two IP addresses (one for A and one for B). Use
name based virtual hosting and give all virtual hosts on a single
machine the same IP address.

> The backhand diagnostic page looks fine. It shows four entries with
> the correct four addresses (column #4).

The problem is that not all 4 IP addresses will serve all the data. 2
will serve A and 2 will serve B. You are lucky that only one of the
tests failed. Potential any of the tests could fail.

> I have been using mod_backhand 1.2.0 with apache 1.3.19.

This should work fine.

> Machine 1:
>

Add:
NameVirtualHost 217.65.128.25
MultiCastStats 217.65.128.25 225.220.221.20:4445,1
AcceptStats 217.65.128.25
AcceptStats 217.65.128.26

> Listen 217.65.128.25:80
> <VirtualHost 217.65.128.25:80>
> ServerName a

Drop these four lines, they should be global above.
> UnixSocketDir /www/logs/backhand
> MultiCastStats 217.65.128.25 225.220.221.20:4445,1
> AcceptStats 217.65.128.25
> AcceptStats 217.65.128.26

> DocumentRoot /www/htdocs/a
> </VirtualHost>
> <Directory /www/htdocs/a>
> Backhand byAge
> Backhand byLoad
> </Directory>
>
>

Drop the listen. and change the IP to be .25
> Listen 217.65.128.75:80

> <VirtualHost 217.65.128.75:80>

<VirtualHost 27.65.128.25>

> ServerName b

Drop these 4 lines. only need this declared one. there is only one
moderator process to configure.

> UnixSocketDir /www/logs/backhand2
> MultiCastStats 217.65.128.75 225.220.221.70:4446,1
> AcceptStats 217.65.128.75
> AcceptStats 217.65.128.76
> DocumentRoot /www/htdocs/b
> </VirtualHost>
> <Directory /www/htdocs/b>
> Backhand byAge
> Backhand byLoad
> </Directory>
>
>
> Machine 2:

Same thing as above. Pull the first set of UnixSocketDir,
MulticastStats, AcceptStats up here. Add a NameVirtualHost for
217.65.128.26 and give both VirtualHosts below the same IP.

> Listen 217.65.128.26:80
> <VirtualHost 217.65.128.26:80>
> ServerName a
> UnixSocketDir /www/logs/backhand
> MultiCastStats 217.65.128.26 225.220.221.20:4445,1
> AcceptStats 217.65.128.25
> AcceptStats 217.65.128.26
> DocumentRoot /www/htdocs/a
> </VirtualHost>
> <Directory /www/htdocs/a>
> Backhand byAge
> Backhand byLoad
> </Directory>
>
>
> Listen 217.65.128.76:80
> <VirtualHost 217.65.128.76:80>
> ServerName b
> UnixSocketDir /www/logs/backhand2
> MultiCastStats 217.65.128.76 225.220.221.70:4446,1
> AcceptStats 217.65.128.75
> AcceptStats 217.65.128.76
> DocumentRoot /www/htdocs/b
> </VirtualHost>
> <Directory /www/htdocs/b>
> Backhand byAge
> Backhand byLoad
> </Directory>
>
> _______________________________________________
> backhand-users mailing list
> backhand-users@lists.backhand.org
> http://lists.backhand.org/mailman/listinfo/backhand-users
>
--
Theo Schlossnagle
1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7
[mod_backhand-users] Question concerning mod_backhand and virtual hosts [ In reply to ]
> > It is possible to have a configuration desribed as above?
>
> Yes. Using name based virtual hosting. I do it here.
>
> > I have included my virtual host configuration. Do you see what
> > mistake I made?
>
> Yes. Machine 1 has two IP addresses (one for A and one for B). Use
> name based virtual hosting and give all virtual hosts on a single
> machine the same IP address.

Thank you for your help so far. It helped me a lot.

There is still one question.

If not by IP would it be possible to have several hosts on one
machine serving under backhand using different ports?

So if machine 1 gets a request for 11.22.33.1:80 it will be
fullfilled by 11.22.33.2:80 or 11.22.33.2:80, but if it gets a request for
11.22.33.1:81 it will be fullfilled by 11.22.33.1:81 or 11.22.33.2:81?

As far as I have noticed backhand only forwards requests to
server (and port) specified in the (one) MultiCastStats param.

Martin
[mod_backhand-users] Question concerning mod_backhand and virtual hosts [ In reply to ]
On Thursday, November 15, 2001, at 10:28 AM, Martin Trzaskalik wrote:
> If not by IP would it be possible to have several hosts on one
> machine serving under backhand using different ports?
>
> So if machine 1 gets a request for 11.22.33.1:80 it will be
> fullfilled by 11.22.33.2:80 or 11.22.33.2:80, but if it gets a request
> for
> 11.22.33.1:81 it will be fullfilled by 11.22.33.1:81 or 11.22.33.2:81?
>
> As far as I have noticed backhand only forwards requests to
> server (and port) specified in the (one) MultiCastStats param.

Short answer, no. Long answer, yes. :-)

Currently, mod_backhand inserts into the serverstats table based on
unique IP address, not unique IP:port combination. I was sent a patch
for this, but have not yet applied it. You can go through the list
archives and find it if you need it right away.

After this patch is applied, you can write a custom candidacy function
called "bySamePort" that only keeps servers in the serverstats table
that have the same port as the invoked virtual server.

The patch will be applied before the next release.

On a side note, having an online repository for people candidacy
functions would be really cool. As I remember, Sean offered to right
one up. As he suffers from the same "only 24 hours in a day" problem
that I do, it still isn't finished. ;-) It would be slick to have a
section on the mod_backhand site for people to post candidacy functions
and review them.

--
Theo Schlossnagle
1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7