tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: AW: AW: grab hostname from tomcat manager
Date Thu, 03 Apr 2014 16:08:26 GMT
Hash: SHA256


On 4/3/14, 5:14 AM, André Warnier wrote:
> wrote:
>>> -----Ursprüngliche Nachricht----- Von: Christopher Schultz
>>> [] Gesendet: Mittwoch, 2.
>>> April 2014 22:33 An: Tomcat Users List Betreff: Re: AW: grab
>>> hostname from tomcat manager
>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>>> Bjorn,
>>> On 4/2/14, 10:54 AM, wrote:
>>>>> -----Ursprüngliche Nachricht----- Von: André Warnier 
>>>>> [] Gesendet: Mittwoch, 2. April 2014
>>>>> 16:35 An: Tomcat Users List Betreff: Re: grab hostname from
>>>>> tomcat manager
>>>>> wrote:
>>>>>> Hello,
>>>>>> I need to grab the hostname from the tomcat manager
>>>>>> somehow. Unfortunately this URL "manager/text/serverinfo"
>>>>>> doesn't contain
>>> the
>>>>> hostname.
>>>>>> Is there any other smart way to receive the hostname via
>>>>>> tomcat
>>>>> manager app? For give me for asking, but how do you access
>>>>> the tomcat manager if you do not know the hostname ?
>>>> Good question :). But I got a good reason for it.
>>>> I got two servers with several tomcat instances. In front of
>>>> them is
>>> a
>>>> loadbalancer with is configured to do a failover.
>>>> -LB- /               \ Server1:8081         Server2:8081
>>>> I need to write a shell script to sync a specific directory
>>>> and for each tomcat instance I need to know on which one the
>>>> loadbalancer is targeting at the moment.
>>> How will you check to see which one the lb is targeting?
>> That's the question.
>>>> If tomcat 8081 on server 1 is down, the loadbalancer will
>>>> point to server 2 tomcat 8081. I can find it out through the
>>>> loadbalancer address only.
>>> You should probably set a jvmRoute in your <Engine> in
>>> server.xml. That way, you can detect which back-end server you
>>> are getting just by looking at the JSESSIONID cookie.
>> That's the answer. When jvmroute is define I easily can receive
>> the jsession id with wget:
>> wget -q -O - --no-cache --keep-session-cookies
>> --no-check-certificate --save-cookies cookies.txt
>> https://loadbalanceraddress:8081/manager 
>> --user=user--password=secure 1>/dev/null
>> perfect!
> Alternatively, I suppose that you could just create a small JSP (or
> even HTML, but then host-specific) page in each host, which returns
> the real hostname.
> You should probably be careful however : in your rsync scenario
> above, is there any guarantee that between the time you ask for the
> hostname (in whatever way), and the time at which you do your
> rsync, the "targeted host" will still be the same ? Remember that
> if things /can/ happen, they /do/ happen.

I still don't really grok the use case, here, but if you use a bogus
JSESSIONID (like GimmieMyServer.jvmRoute), you can select the backend
server if you are using a load balancer that understands what the
jvmRoute means (like mod_jk does, for instance).

- -chris
Version: GnuPG v1
Comment: GPGTools -
Comment: Using GnuPG with Thunderbird -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message