Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6CE9D10499 for ; Thu, 3 Apr 2014 09:14:43 +0000 (UTC) Received: (qmail 76672 invoked by uid 500); 3 Apr 2014 09:14:37 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 76378 invoked by uid 500); 3 Apr 2014 09:14:36 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 76369 invoked by uid 99); 3 Apr 2014 09:14:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2014 09:14:35 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of aw@ice-sa.com designates 212.85.38.228 as permitted sender) Received: from [212.85.38.228] (HELO tor.combios.es) (212.85.38.228) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2014 09:14:30 +0000 Received: from [192.168.245.129] (HSI-KBW-46-237-206-233.hsi.kabel-badenwuerttemberg.de [46.237.206.233]) (Authenticated sender: andre.warnier@ice-sa.com) by tor.combios.es (Postfix) with ESMTPA id 2B45A3C271C for ; Thu, 3 Apr 2014 11:14:34 +0200 (CEST) Message-ID: <533D2660.8080703@ice-sa.com> Date: Thu, 03 Apr 2014 11:14:08 +0200 From: =?UTF-8?B?QW5kcsOpIFdhcm5pZXI=?= Reply-To: Tomcat Users List User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Tomcat Users List Subject: Re: AW: AW: grab hostname from tomcat manager References: <533C2017.6010407@ice-sa.com> <533C73EE.4080600@christopherschultz.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Bjoern.Becker@easycash.de wrote: >> -----Ursprüngliche Nachricht----- >> Von: Christopher Schultz [mailto:chris@christopherschultz.net] >> 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, Bjoern.Becker@easycash.de wrote: >>>> -----Ursprüngliche Nachricht----- Von: André Warnier >>>> [mailto:aw@ice-sa.com] Gesendet: Mittwoch, 2. April 2014 16:35 >>>> An: Tomcat Users List Betreff: Re: grab hostname from tomcat manager >>>> >>>> Bjoern.Becker@easycash.de 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 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. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org