You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Thiago Locatelli da Silva <th...@digitro.com.br> on 2010/08/27 14:17:54 UTC
Tomcat load balancing question x problem
Hello list! :)
Here at work I was asked to give a try on load balancing two tomcat
servers running tomcat 6.0.29. The problem is that I was given only two
servers to do this, what gave me only one option: run the apache in one
of these servers. So I decided to put the apache httpd server which is
going to balance the load among the two tomcat server in the Server A
(suppousing I have server A and B running linux). My application which
needs to be balanced has "/agent" context.
Everytime I access the URL http://servera/agent my request is redirect
either to http://servera:8080/agent or http://serverb:8080/agent. To my
understanding, with load balancing, my url would remain
http://servera/agent and the redirect would take place behing the scene
and I would never see any redirect to tomcat connector port (8080). By
the way, i am running the load balancing with mod_proxy in the apache
server and my configuration is as follow:
=============================================================
ProxyPass /balancer-manager !
ProxyPass /status !
ProxyStatus On
ProxyRequests Off
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from localhost
</Location>
<Location /status>
SetHandler server-status
Order Deny,Allow
Deny from all
Allow from all
</Location>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Proxy balancer://cluster>
BalancerMember http://servera:8080/agent/ route=worker0 keepalive=On
loadfactor=1
BalancerMember http://serverb:8080/agent/ route=worker1 keepalive=On
loadfactor=1
ProxySet lbmethod=byrequests maxattempts=3
stickysession=JSESSIONID|jsessionid
</Proxy>
<Location /agent>
ProxyPass balancer://cluster/ stickysession=JSESSIONID
ProxyPassReverse balancer://cluster/
</Location>
=============================================================
Not happy with this scenario, i decided to install the apache httpd
server in my laptop and made it as my load balancer instead of using
servera to load balance. For my surprise, it worked out of the box with
no extra configuration other than the one set up in my servera. I see no
redirects to 8080 tomcat's port, due to my overall tests i could see
only my desired url: http//localhost/agent (since i was running my tests
with apache installed locally).
So my question is: does it make sense to have the load balancer in the
same server as one of the balanced server/application? Does mod_proxy
support this?
Many thanks for all the attention
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat load balancing question x problem
Posted by Ozgur Ozdemircili <oz...@gmail.com>.
hi,
This seems the correct way to do. The best way to do it is to use a balanced
ip.
In my setup I use the same http.conf and workers file on both of the server.
When one tomcat goes down the apache sends all the rest of the queries to
second node. When the apache goes down the load balancer, in my case
piranha, takes over and assigns the public ip to the working server.
Best!
Özgür Özdemircili
http://www.acikkod.org
Code so clean you could eat off it
On Mon, Aug 30, 2010 at 8:55 AM, Luca Gervasi <to...@ashetic.net> wrote:
> On Fri, 2010-08-27 at 09:17 -0300, Thiago Locatelli da Silva wrote:
> > Hello list! :)
> >
> > Here at work I was asked to give a try on load balancing two tomcat
> > servers running tomcat 6.0.29. The problem is that I was given only two
> > servers to do this, what gave me only one option: run the apache in one
> > of these servers. So I decided to put the apache httpd server which is
> > going to balance the load among the two tomcat server in the Server A
> > (suppousing I have server A and B running linux). My application which
> > needs to be balanced has "/agent" context.
> >
> > Everytime I access the URL http://servera/agent my request is redirect
> > either to http://servera:8080/agent or http://serverb:8080/agent. To my
> > understanding, with load balancing, my url would remain
> > http://servera/agent and the redirect would take place behing the scene
> > and I would never see any redirect to tomcat connector port (8080). By
> > the way, i am running the load balancing with mod_proxy in the apache
> > server and my configuration is as follow:
> >
> > =============================================================
> >
> > ProxyPass /balancer-manager !
> > ProxyPass /status !
> > ProxyStatus On
> > ProxyRequests Off
> >
> > <Location /balancer-manager>
> > SetHandler balancer-manager
> > Order Deny,Allow
> > Deny from all
> > Allow from localhost
> > </Location>
> >
> > <Location /status>
> > SetHandler server-status
> > Order Deny,Allow
> > Deny from all
> > Allow from all
> > </Location>
> >
> > <Proxy *>
> > Order deny,allow
> > Allow from all
> > </Proxy>
> >
> > <Proxy balancer://cluster>
> > BalancerMember http://servera:8080/agent/ route=worker0 keepalive=On
> > loadfactor=1
> > BalancerMember http://serverb:8080/agent/ route=worker1 keepalive=On
> > loadfactor=1
> > ProxySet lbmethod=byrequests maxattempts=3
> > stickysession=JSESSIONID|jsessionid
> > </Proxy>
> >
> > <Location /agent>
> > ProxyPass balancer://cluster/ stickysession=JSESSIONID
> > ProxyPassReverse balancer://cluster/
> > </Location>
> >
> > =============================================================
> >
> > Not happy with this scenario, i decided to install the apache httpd
> > server in my laptop and made it as my load balancer instead of using
> > servera to load balance. For my surprise, it worked out of the box with
> > no extra configuration other than the one set up in my servera. I see no
> > redirects to 8080 tomcat's port, due to my overall tests i could see
> > only my desired url: http//localhost/agent (since i was running my tests
> > with apache installed locally).
> >
> > So my question is: does it make sense to have the load balancer in the
> > same server as one of the balanced server/application? Does mod_proxy
> > support this?
> >
> > Many thanks for all the attention
> >
> > Thiago
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
> Load balancing two tomcat with _two_ server is really... unusual :D
>
> I'd do this way:
> two httpd, one on each server, with a balanced ip (keepalived). Each
> httpd will use mod_jk and a balanced worker between the two istances.
>
> The server should have a second nic, to directly connect the two server
> with a different subnet.
>
> Consider that the two httpd are in an active/standby status. If one
> server goes down (i mean...it is off-duty), you'll end up with only one
> frontend working with one backend.
>
> If the "public" nic goes down, you'll end up with one frontend and two
> balanced backend.
>
> This is surely not an optimal solution, you know...
>
> If you have other frontend, you could use them to balance the two
> backends...mod_jk is not so consuming, after all.
>
> My 2 cents.
>
> Luca Gervasi
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Tomcat load balancing question x problem
Posted by Thiago Locatelli da Silva <th...@digitro.com.br>.
Thanks for your two cents Luca, they are a pretty smart idea on how to
load balance thing in a expert way, however this is not a reality when
you work for a company that a thinking line as "do more with less", they
wont give me an extra nic for load balancing neither a third server...
my constraint is: make servera do the balancing among servera itself and
serverb. At a first sight I tought "what the heck?" since my small and
insignifcant knowledge on architecture tell me that it stinks and its
not a good practice, but since they pay for the food I eat and for the
girls I hook up, lets do the way then want and in the future when they
discover that it was not a good practice i will tell them: "i told ya"
*Thiago Locatelli da Silva*
/Analista de Sistemas/
/SIC - TDI - Tecnologia em Desenvolvimento de Interfaces/
*DÍGITRO TECNOLOGIA*
*E-mail:* thiago.silva@digitro.com.br <ma...@digitro.com.br>
*Fone:* +55 48 3281-7000* Ramal:* 7726
*Fax:* +55 48 3281-7299
*Site:* www.digitro.com <http://www.digitro.com>
/"Antes de imprimir, pense na sua responsabilidade e no seu compromisso
com o meio ambiente"/
Esta mensagem, incluindo seus anexos, é reservada somente à Dígitro e ao
destinatário da mensagem. Caso você tenha recebido esta mensagem por
engano, queira por favor, retorná-la ao remetente e apagá-la de seus
arquivos.
Luca Gervasi escreveu:
> On Fri, 2010-08-27 at 09:17 -0300, Thiago Locatelli da Silva wrote:
>
>> Hello list! :)
>>
>> Here at work I was asked to give a try on load balancing two tomcat
>> servers running tomcat 6.0.29. The problem is that I was given only two
>> servers to do this, what gave me only one option: run the apache in one
>> of these servers. So I decided to put the apache httpd server which is
>> going to balance the load among the two tomcat server in the Server A
>> (suppousing I have server A and B running linux). My application which
>> needs to be balanced has "/agent" context.
>>
>> Everytime I access the URL http://servera/agent my request is redirect
>> either to http://servera:8080/agent or http://serverb:8080/agent. To my
>> understanding, with load balancing, my url would remain
>> http://servera/agent and the redirect would take place behing the scene
>> and I would never see any redirect to tomcat connector port (8080). By
>> the way, i am running the load balancing with mod_proxy in the apache
>> server and my configuration is as follow:
>>
>> =============================================================
>>
>> ProxyPass /balancer-manager !
>> ProxyPass /status !
>> ProxyStatus On
>> ProxyRequests Off
>>
>> <Location /balancer-manager>
>> SetHandler balancer-manager
>> Order Deny,Allow
>> Deny from all
>> Allow from localhost
>> </Location>
>>
>> <Location /status>
>> SetHandler server-status
>> Order Deny,Allow
>> Deny from all
>> Allow from all
>> </Location>
>>
>> <Proxy *>
>> Order deny,allow
>> Allow from all
>> </Proxy>
>>
>> <Proxy balancer://cluster>
>> BalancerMember http://servera:8080/agent/ route=worker0 keepalive=On
>> loadfactor=1
>> BalancerMember http://serverb:8080/agent/ route=worker1 keepalive=On
>> loadfactor=1
>> ProxySet lbmethod=byrequests maxattempts=3
>> stickysession=JSESSIONID|jsessionid
>> </Proxy>
>>
>> <Location /agent>
>> ProxyPass balancer://cluster/ stickysession=JSESSIONID
>> ProxyPassReverse balancer://cluster/
>> </Location>
>>
>> =============================================================
>>
>> Not happy with this scenario, i decided to install the apache httpd
>> server in my laptop and made it as my load balancer instead of using
>> servera to load balance. For my surprise, it worked out of the box with
>> no extra configuration other than the one set up in my servera. I see no
>> redirects to 8080 tomcat's port, due to my overall tests i could see
>> only my desired url: http//localhost/agent (since i was running my tests
>> with apache installed locally).
>>
>> So my question is: does it make sense to have the load balancer in the
>> same server as one of the balanced server/application? Does mod_proxy
>> support this?
>>
>> Many thanks for all the attention
>>
>> Thiago
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
> Load balancing two tomcat with _two_ server is really... unusual :D
>
> I'd do this way:
> two httpd, one on each server, with a balanced ip (keepalived). Each
> httpd will use mod_jk and a balanced worker between the two istances.
>
> The server should have a second nic, to directly connect the two server
> with a different subnet.
>
> Consider that the two httpd are in an active/standby status. If one
> server goes down (i mean...it is off-duty), you'll end up with only one
> frontend working with one backend.
>
> If the "public" nic goes down, you'll end up with one frontend and two
> balanced backend.
>
> This is surely not an optimal solution, you know...
>
> If you have other frontend, you could use them to balance the two
> backends...mod_jk is not so consuming, after all.
>
> My 2 cents.
>
> Luca Gervasi
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat load balancing question x problem
Posted by Luca Gervasi <to...@ashetic.net>.
On Fri, 2010-08-27 at 09:17 -0300, Thiago Locatelli da Silva wrote:
> Hello list! :)
>
> Here at work I was asked to give a try on load balancing two tomcat
> servers running tomcat 6.0.29. The problem is that I was given only two
> servers to do this, what gave me only one option: run the apache in one
> of these servers. So I decided to put the apache httpd server which is
> going to balance the load among the two tomcat server in the Server A
> (suppousing I have server A and B running linux). My application which
> needs to be balanced has "/agent" context.
>
> Everytime I access the URL http://servera/agent my request is redirect
> either to http://servera:8080/agent or http://serverb:8080/agent. To my
> understanding, with load balancing, my url would remain
> http://servera/agent and the redirect would take place behing the scene
> and I would never see any redirect to tomcat connector port (8080). By
> the way, i am running the load balancing with mod_proxy in the apache
> server and my configuration is as follow:
>
> =============================================================
>
> ProxyPass /balancer-manager !
> ProxyPass /status !
> ProxyStatus On
> ProxyRequests Off
>
> <Location /balancer-manager>
> SetHandler balancer-manager
> Order Deny,Allow
> Deny from all
> Allow from localhost
> </Location>
>
> <Location /status>
> SetHandler server-status
> Order Deny,Allow
> Deny from all
> Allow from all
> </Location>
>
> <Proxy *>
> Order deny,allow
> Allow from all
> </Proxy>
>
> <Proxy balancer://cluster>
> BalancerMember http://servera:8080/agent/ route=worker0 keepalive=On
> loadfactor=1
> BalancerMember http://serverb:8080/agent/ route=worker1 keepalive=On
> loadfactor=1
> ProxySet lbmethod=byrequests maxattempts=3
> stickysession=JSESSIONID|jsessionid
> </Proxy>
>
> <Location /agent>
> ProxyPass balancer://cluster/ stickysession=JSESSIONID
> ProxyPassReverse balancer://cluster/
> </Location>
>
> =============================================================
>
> Not happy with this scenario, i decided to install the apache httpd
> server in my laptop and made it as my load balancer instead of using
> servera to load balance. For my surprise, it worked out of the box with
> no extra configuration other than the one set up in my servera. I see no
> redirects to 8080 tomcat's port, due to my overall tests i could see
> only my desired url: http//localhost/agent (since i was running my tests
> with apache installed locally).
>
> So my question is: does it make sense to have the load balancer in the
> same server as one of the balanced server/application? Does mod_proxy
> support this?
>
> Many thanks for all the attention
>
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Load balancing two tomcat with _two_ server is really... unusual :D
I'd do this way:
two httpd, one on each server, with a balanced ip (keepalived). Each
httpd will use mod_jk and a balanced worker between the two istances.
The server should have a second nic, to directly connect the two server
with a different subnet.
Consider that the two httpd are in an active/standby status. If one
server goes down (i mean...it is off-duty), you'll end up with only one
frontend working with one backend.
If the "public" nic goes down, you'll end up with one frontend and two
balanced backend.
This is surely not an optimal solution, you know...
If you have other frontend, you could use them to balance the two
backends...mod_jk is not so consuming, after all.
My 2 cents.
Luca Gervasi
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat load balancing question x problem
Posted by Thiago Locatelli da Silva <th...@digitro.com.br>.
My apache version is 2.2.3 as follow.
[root@servera ~]$ httpd -version
Server version: Apache/2.2.3
Server built: Nov 10 2007 12:44:08
I will take a look at your suggestions and give a try. I will be further
posting my finding on this thread.
Thanks a lot Rainer
T
Rainer Jung escreveu:
> On 27.08.2010 14:17, Thiago Locatelli da Silva wrote:
>> Hello list! :)
>>
>> Here at work I was asked to give a try on load balancing two tomcat
>> servers running tomcat 6.0.29. The problem is that I was given only two
>> servers to do this, what gave me only one option: run the apache in one
>> of these servers. So I decided to put the apache httpd server which is
>> going to balance the load among the two tomcat server in the Server A
>> (suppousing I have server A and B running linux). My application which
>> needs to be balanced has "/agent" context.
>>
>> Everytime I access the URL http://servera/agent my request is redirect
>> either to http://servera:8080/agent or http://serverb:8080/agent. To my
>> understanding, with load balancing, my url would remain
>> http://servera/agent and the redirect would take place behing the scene
>> and I would never see any redirect to tomcat connector port (8080). By
>> the way, i am running the load balancing with mod_proxy in the apache
>> server and my configuration is as follow:
>>
>> =============================================================
>>
>> ProxyPass /balancer-manager !
>> ProxyPass /status !
>> ProxyStatus On
>> ProxyRequests Off
>>
>> <Location /balancer-manager>
>> SetHandler balancer-manager
>> Order Deny,Allow
>> Deny from all
>> Allow from localhost </Location>
>>
>> <Location /status>
>> SetHandler server-status
>> Order Deny,Allow
>> Deny from all
>> Allow from all
>> </Location>
>>
>> <Proxy *>
>> Order deny,allow
>> Allow from all
>> </Proxy>
>>
>> <Proxy balancer://cluster>
>> BalancerMember http://servera:8080/agent/ route=worker0 keepalive=On
>> loadfactor=1
>> BalancerMember http://serverb:8080/agent/ route=worker1 keepalive=On
>> loadfactor=1
>> ProxySet lbmethod=byrequests maxattempts=3
>> stickysession=JSESSIONID|jsessionid
>> </Proxy>
>>
>> <Location /agent>
>> ProxyPass balancer://cluster/ stickysession=JSESSIONID
>> ProxyPassReverse balancer://cluster/
>> </Location>
>>
>> =============================================================
>>
>> Not happy with this scenario, i decided to install the apache httpd
>> server in my laptop and made it as my load balancer instead of using
>> servera to load balance. For my surprise, it worked out of the box with
>> no extra configuration other than the one set up in my servera. I see no
>> redirects to 8080 tomcat's port, due to my overall tests i could see
>> only my desired url: http//localhost/agent (since i was running my tests
>> with apache installed locally).
>>
>> So my question is: does it make sense to have the load balancer in the
>> same server as one of the balanced server/application? Does mod_proxy
>> support this?
>>
>> Many thanks for all the attention
>
> The wrong redirect URLs should have been rewritten by
> ProxyPassReverse. Note that using the balancer URL in ProxyPassReverse
> only works starting with Apache 2.2.12. Before you had to give one
> ProxyPassReverse statement for each backend URL configured as part of
> the balancer, e.g.
>
> ProxyPassReverse /agent http://servera:8080/agent
> ProxyPassReverse /agent http://serverb:8080/agent
>
> It is simply a rule to rewrite the Location header contained in any
> 30x response, i.e. replacing the string to the right with the string
> to the left (if it prefixes the Location URL).
>
> I suggest you
>
> - make sure you have a recent Apache (2.2.16 is the latest 2.2.x)
>
> - inspect the exact redirect response using a browser plugin or
> network sniffing, especially check the contents of the Location header
>
> - try using the split ProxyPassReverse pr backend configuration
>
> Regards,
>
> Rainer
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat load balancing question x problem
Posted by Thiago Locatelli da Silva <th...@digitro.com.br>.
Thats the way my mod_proxy conf is right now
<Proxy balancer://cluster>
BalancerMember http://servera:8080/agent/ route=worker0 keepalive=On
loadfactor=1
BalancerMember http://serverb:8080/agent/ route=worker1 keepalive=On
loadfactor=1
ProxySet lbmethod=byrequests maxattempts=3
stickysession=JSESSIONID|jsessionid
</Proxy>
<Location /agent/>
ProxyPass balancer://cluster/ stickysession=JSESSIONID
ProxyPassReverse http://servera:8080/agent/
ProxyPassReverse http://serverb:8080/agent/
</Location>
The problem is that when I use my laptop as load balancer it works fine,
even the comet part of the application works all right. In this scenario
I have my laptop balancing the load among servera and serverb. However,
when I use servera as the load balancer, the comet part doesnt seem to
be working as I dont get any response from the server, but the load is
being balanced properly.
Rainer Jung escreveu:
> On 27.08.2010 19:22, Thiago Locatelli da Silva wrote:
>> Hi Rainer,
>>
>> I followed your suggestions and it seems to be working, the load
>> balacing, now i need to look into why my application, created with gwt +
>> comet is not working. It seems that comet stopped working.
>
> Any information about what the solution was? Upgrading Apache, using
> the backend server URLs in ProxyPassReverse, something else?
>
> Regards,
>
> Rainer
>
>> Rainer Jung escreveu:
>>> On 27.08.2010 14:17, Thiago Locatelli da Silva wrote:
>>>> Hello list! :)
>>>>
>>>> Here at work I was asked to give a try on load balancing two tomcat
>>>> servers running tomcat 6.0.29. The problem is that I was given only
>>>> two
>>>> servers to do this, what gave me only one option: run the apache in
>>>> one
>>>> of these servers. So I decided to put the apache httpd server which is
>>>> going to balance the load among the two tomcat server in the Server A
>>>> (suppousing I have server A and B running linux). My application which
>>>> needs to be balanced has "/agent" context.
>>>>
>>>> Everytime I access the URL http://servera/agent my request is redirect
>>>> either to http://servera:8080/agent or http://serverb:8080/agent.
>>>> To my
>>>> understanding, with load balancing, my url would remain
>>>> http://servera/agent and the redirect would take place behing the
>>>> scene
>>>> and I would never see any redirect to tomcat connector port (8080). By
>>>> the way, i am running the load balancing with mod_proxy in the apache
>>>> server and my configuration is as follow:
>>>>
>>>> =============================================================
>>>>
>>>> ProxyPass /balancer-manager !
>>>> ProxyPass /status !
>>>> ProxyStatus On
>>>> ProxyRequests Off
>>>>
>>>> <Location /balancer-manager>
>>>> SetHandler balancer-manager
>>>> Order Deny,Allow
>>>> Deny from all
>>>> Allow from localhost </Location>
>>>>
>>>> <Location /status>
>>>> SetHandler server-status
>>>> Order Deny,Allow
>>>> Deny from all
>>>> Allow from all
>>>> </Location>
>>>>
>>>> <Proxy *>
>>>> Order deny,allow
>>>> Allow from all
>>>> </Proxy>
>>>>
>>>> <Proxy balancer://cluster>
>>>> BalancerMember http://servera:8080/agent/ route=worker0 keepalive=On
>>>> loadfactor=1
>>>> BalancerMember http://serverb:8080/agent/ route=worker1 keepalive=On
>>>> loadfactor=1
>>>> ProxySet lbmethod=byrequests maxattempts=3
>>>> stickysession=JSESSIONID|jsessionid
>>>> </Proxy>
>>>>
>>>> <Location /agent>
>>>> ProxyPass balancer://cluster/ stickysession=JSESSIONID
>>>> ProxyPassReverse balancer://cluster/
>>>> </Location>
>>>>
>>>> =============================================================
>>>>
>>>> Not happy with this scenario, i decided to install the apache httpd
>>>> server in my laptop and made it as my load balancer instead of using
>>>> servera to load balance. For my surprise, it worked out of the box
>>>> with
>>>> no extra configuration other than the one set up in my servera. I
>>>> see no
>>>> redirects to 8080 tomcat's port, due to my overall tests i could see
>>>> only my desired url: http//localhost/agent (since i was running my
>>>> tests
>>>> with apache installed locally).
>>>>
>>>> So my question is: does it make sense to have the load balancer in the
>>>> same server as one of the balanced server/application? Does mod_proxy
>>>> support this?
>>>>
>>>> Many thanks for all the attention
>>>
>>> The wrong redirect URLs should have been rewritten by
>>> ProxyPassReverse. Note that using the balancer URL in ProxyPassReverse
>>> only works starting with Apache 2.2.12. Before you had to give one
>>> ProxyPassReverse statement for each backend URL configured as part of
>>> the balancer, e.g.
>>>
>>> ProxyPassReverse /agent http://servera:8080/agent
>>> ProxyPassReverse /agent http://serverb:8080/agent
>>>
>>> It is simply a rule to rewrite the Location header contained in any
>>> 30x response, i.e. replacing the string to the right with the string
>>> to the left (if it prefixes the Location URL).
>>>
>>> I suggest you
>>>
>>> - make sure you have a recent Apache (2.2.16 is the latest 2.2.x)
>>>
>>> - inspect the exact redirect response using a browser plugin or
>>> network sniffing, especially check the contents of the Location header
>>>
>>> - try using the split ProxyPassReverse pr backend configuration
>>>
>>> Regards,
>>>
>>> Rainer
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat load balancing question x problem
Posted by Rainer Jung <ra...@kippdata.de>.
On 27.08.2010 19:22, Thiago Locatelli da Silva wrote:
> Hi Rainer,
>
> I followed your suggestions and it seems to be working, the load
> balacing, now i need to look into why my application, created with gwt +
> comet is not working. It seems that comet stopped working.
Any information about what the solution was? Upgrading Apache, using the
backend server URLs in ProxyPassReverse, something else?
Regards,
Rainer
> Rainer Jung escreveu:
>> On 27.08.2010 14:17, Thiago Locatelli da Silva wrote:
>>> Hello list! :)
>>>
>>> Here at work I was asked to give a try on load balancing two tomcat
>>> servers running tomcat 6.0.29. The problem is that I was given only two
>>> servers to do this, what gave me only one option: run the apache in one
>>> of these servers. So I decided to put the apache httpd server which is
>>> going to balance the load among the two tomcat server in the Server A
>>> (suppousing I have server A and B running linux). My application which
>>> needs to be balanced has "/agent" context.
>>>
>>> Everytime I access the URL http://servera/agent my request is redirect
>>> either to http://servera:8080/agent or http://serverb:8080/agent. To my
>>> understanding, with load balancing, my url would remain
>>> http://servera/agent and the redirect would take place behing the scene
>>> and I would never see any redirect to tomcat connector port (8080). By
>>> the way, i am running the load balancing with mod_proxy in the apache
>>> server and my configuration is as follow:
>>>
>>> =============================================================
>>>
>>> ProxyPass /balancer-manager !
>>> ProxyPass /status !
>>> ProxyStatus On
>>> ProxyRequests Off
>>>
>>> <Location /balancer-manager>
>>> SetHandler balancer-manager
>>> Order Deny,Allow
>>> Deny from all
>>> Allow from localhost </Location>
>>>
>>> <Location /status>
>>> SetHandler server-status
>>> Order Deny,Allow
>>> Deny from all
>>> Allow from all
>>> </Location>
>>>
>>> <Proxy *>
>>> Order deny,allow
>>> Allow from all
>>> </Proxy>
>>>
>>> <Proxy balancer://cluster>
>>> BalancerMember http://servera:8080/agent/ route=worker0 keepalive=On
>>> loadfactor=1
>>> BalancerMember http://serverb:8080/agent/ route=worker1 keepalive=On
>>> loadfactor=1
>>> ProxySet lbmethod=byrequests maxattempts=3
>>> stickysession=JSESSIONID|jsessionid
>>> </Proxy>
>>>
>>> <Location /agent>
>>> ProxyPass balancer://cluster/ stickysession=JSESSIONID
>>> ProxyPassReverse balancer://cluster/
>>> </Location>
>>>
>>> =============================================================
>>>
>>> Not happy with this scenario, i decided to install the apache httpd
>>> server in my laptop and made it as my load balancer instead of using
>>> servera to load balance. For my surprise, it worked out of the box with
>>> no extra configuration other than the one set up in my servera. I see no
>>> redirects to 8080 tomcat's port, due to my overall tests i could see
>>> only my desired url: http//localhost/agent (since i was running my tests
>>> with apache installed locally).
>>>
>>> So my question is: does it make sense to have the load balancer in the
>>> same server as one of the balanced server/application? Does mod_proxy
>>> support this?
>>>
>>> Many thanks for all the attention
>>
>> The wrong redirect URLs should have been rewritten by
>> ProxyPassReverse. Note that using the balancer URL in ProxyPassReverse
>> only works starting with Apache 2.2.12. Before you had to give one
>> ProxyPassReverse statement for each backend URL configured as part of
>> the balancer, e.g.
>>
>> ProxyPassReverse /agent http://servera:8080/agent
>> ProxyPassReverse /agent http://serverb:8080/agent
>>
>> It is simply a rule to rewrite the Location header contained in any
>> 30x response, i.e. replacing the string to the right with the string
>> to the left (if it prefixes the Location URL).
>>
>> I suggest you
>>
>> - make sure you have a recent Apache (2.2.16 is the latest 2.2.x)
>>
>> - inspect the exact redirect response using a browser plugin or
>> network sniffing, especially check the contents of the Location header
>>
>> - try using the split ProxyPassReverse pr backend configuration
>>
>> Regards,
>>
>> Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat load balancing question x problem
Posted by Thiago Locatelli da Silva <th...@digitro.com.br>.
Hi Rainer,
I followed your suggestions and it seems to be working, the load
balacing, now i need to look into why my application, created with gwt +
comet is not working. It seems that comet stopped working.
Thanks
T
Rainer Jung escreveu:
> On 27.08.2010 14:17, Thiago Locatelli da Silva wrote:
>> Hello list! :)
>>
>> Here at work I was asked to give a try on load balancing two tomcat
>> servers running tomcat 6.0.29. The problem is that I was given only two
>> servers to do this, what gave me only one option: run the apache in one
>> of these servers. So I decided to put the apache httpd server which is
>> going to balance the load among the two tomcat server in the Server A
>> (suppousing I have server A and B running linux). My application which
>> needs to be balanced has "/agent" context.
>>
>> Everytime I access the URL http://servera/agent my request is redirect
>> either to http://servera:8080/agent or http://serverb:8080/agent. To my
>> understanding, with load balancing, my url would remain
>> http://servera/agent and the redirect would take place behing the scene
>> and I would never see any redirect to tomcat connector port (8080). By
>> the way, i am running the load balancing with mod_proxy in the apache
>> server and my configuration is as follow:
>>
>> =============================================================
>>
>> ProxyPass /balancer-manager !
>> ProxyPass /status !
>> ProxyStatus On
>> ProxyRequests Off
>>
>> <Location /balancer-manager>
>> SetHandler balancer-manager
>> Order Deny,Allow
>> Deny from all
>> Allow from localhost </Location>
>>
>> <Location /status>
>> SetHandler server-status
>> Order Deny,Allow
>> Deny from all
>> Allow from all
>> </Location>
>>
>> <Proxy *>
>> Order deny,allow
>> Allow from all
>> </Proxy>
>>
>> <Proxy balancer://cluster>
>> BalancerMember http://servera:8080/agent/ route=worker0 keepalive=On
>> loadfactor=1
>> BalancerMember http://serverb:8080/agent/ route=worker1 keepalive=On
>> loadfactor=1
>> ProxySet lbmethod=byrequests maxattempts=3
>> stickysession=JSESSIONID|jsessionid
>> </Proxy>
>>
>> <Location /agent>
>> ProxyPass balancer://cluster/ stickysession=JSESSIONID
>> ProxyPassReverse balancer://cluster/
>> </Location>
>>
>> =============================================================
>>
>> Not happy with this scenario, i decided to install the apache httpd
>> server in my laptop and made it as my load balancer instead of using
>> servera to load balance. For my surprise, it worked out of the box with
>> no extra configuration other than the one set up in my servera. I see no
>> redirects to 8080 tomcat's port, due to my overall tests i could see
>> only my desired url: http//localhost/agent (since i was running my tests
>> with apache installed locally).
>>
>> So my question is: does it make sense to have the load balancer in the
>> same server as one of the balanced server/application? Does mod_proxy
>> support this?
>>
>> Many thanks for all the attention
>
> The wrong redirect URLs should have been rewritten by
> ProxyPassReverse. Note that using the balancer URL in ProxyPassReverse
> only works starting with Apache 2.2.12. Before you had to give one
> ProxyPassReverse statement for each backend URL configured as part of
> the balancer, e.g.
>
> ProxyPassReverse /agent http://servera:8080/agent
> ProxyPassReverse /agent http://serverb:8080/agent
>
> It is simply a rule to rewrite the Location header contained in any
> 30x response, i.e. replacing the string to the right with the string
> to the left (if it prefixes the Location URL).
>
> I suggest you
>
> - make sure you have a recent Apache (2.2.16 is the latest 2.2.x)
>
> - inspect the exact redirect response using a browser plugin or
> network sniffing, especially check the contents of the Location header
>
> - try using the split ProxyPassReverse pr backend configuration
>
> Regards,
>
> Rainer
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat load balancing question x problem
Posted by Rainer Jung <ra...@kippdata.de>.
On 27.08.2010 14:17, Thiago Locatelli da Silva wrote:
> Hello list! :)
>
> Here at work I was asked to give a try on load balancing two tomcat
> servers running tomcat 6.0.29. The problem is that I was given only two
> servers to do this, what gave me only one option: run the apache in one
> of these servers. So I decided to put the apache httpd server which is
> going to balance the load among the two tomcat server in the Server A
> (suppousing I have server A and B running linux). My application which
> needs to be balanced has "/agent" context.
>
> Everytime I access the URL http://servera/agent my request is redirect
> either to http://servera:8080/agent or http://serverb:8080/agent. To my
> understanding, with load balancing, my url would remain
> http://servera/agent and the redirect would take place behing the scene
> and I would never see any redirect to tomcat connector port (8080). By
> the way, i am running the load balancing with mod_proxy in the apache
> server and my configuration is as follow:
>
> =============================================================
>
> ProxyPass /balancer-manager !
> ProxyPass /status !
> ProxyStatus On
> ProxyRequests Off
>
> <Location /balancer-manager>
> SetHandler balancer-manager
> Order Deny,Allow
> Deny from all
> Allow from localhost </Location>
>
> <Location /status>
> SetHandler server-status
> Order Deny,Allow
> Deny from all
> Allow from all
> </Location>
>
> <Proxy *>
> Order deny,allow
> Allow from all
> </Proxy>
>
> <Proxy balancer://cluster>
> BalancerMember http://servera:8080/agent/ route=worker0 keepalive=On
> loadfactor=1
> BalancerMember http://serverb:8080/agent/ route=worker1 keepalive=On
> loadfactor=1
> ProxySet lbmethod=byrequests maxattempts=3
> stickysession=JSESSIONID|jsessionid
> </Proxy>
>
> <Location /agent>
> ProxyPass balancer://cluster/ stickysession=JSESSIONID
> ProxyPassReverse balancer://cluster/
> </Location>
>
> =============================================================
>
> Not happy with this scenario, i decided to install the apache httpd
> server in my laptop and made it as my load balancer instead of using
> servera to load balance. For my surprise, it worked out of the box with
> no extra configuration other than the one set up in my servera. I see no
> redirects to 8080 tomcat's port, due to my overall tests i could see
> only my desired url: http//localhost/agent (since i was running my tests
> with apache installed locally).
>
> So my question is: does it make sense to have the load balancer in the
> same server as one of the balanced server/application? Does mod_proxy
> support this?
>
> Many thanks for all the attention
The wrong redirect URLs should have been rewritten by ProxyPassReverse.
Note that using the balancer URL in ProxyPassReverse only works starting
with Apache 2.2.12. Before you had to give one ProxyPassReverse
statement for each backend URL configured as part of the balancer, e.g.
ProxyPassReverse /agent http://servera:8080/agent
ProxyPassReverse /agent http://serverb:8080/agent
It is simply a rule to rewrite the Location header contained in any 30x
response, i.e. replacing the string to the right with the string to the
left (if it prefixes the Location URL).
I suggest you
- make sure you have a recent Apache (2.2.16 is the latest 2.2.x)
- inspect the exact redirect response using a browser plugin or network
sniffing, especially check the contents of the Location header
- try using the split ProxyPassReverse pr backend configuration
Regards,
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org