Return-Path: X-Original-To: apmail-hadoop-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AFF3BDBDB for ; Thu, 18 Oct 2012 14:06:02 +0000 (UTC) Received: (qmail 92311 invoked by uid 500); 18 Oct 2012 14:05:58 -0000 Delivered-To: apmail-hadoop-user-archive@hadoop.apache.org Received: (qmail 91935 invoked by uid 500); 18 Oct 2012 14:05:57 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 91906 invoked by uid 99); 18 Oct 2012 14:05:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Oct 2012 14:05:56 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of javadba@gmail.com designates 209.85.212.48 as permitted sender) Received: from [209.85.212.48] (HELO mail-vb0-f48.google.com) (209.85.212.48) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Oct 2012 14:05:51 +0000 Received: by mail-vb0-f48.google.com with SMTP id e21so10351511vbm.35 for ; Thu, 18 Oct 2012 07:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=X0Hp/x5KRPP+aMfmOCv99st/8xaQQcl3cj1jPUAw6xk=; b=olcv2z4NeE4yB8f9kTf3qoW4VSOCdMuCS/iLUUrGaZq00M/9fD0PwE/DWssQwbBS1c upcWLHzRAdgUyGNiLj99xZMzXDRbnxbLhGg/2CUjnaeFRHt3uzx507k44/jLQqJAA7Wd aTlYn3j1mA5ouNAlxLF6h+56MMTitLzZnN05oGsS0XgPYJzwPtsGegaYvarjZhJuM0nC qDufiVqE0RYkVUJ1PP6IRJi7eqsUoP5INJfuAU7C/jPisei6hhk/9TMlxnX4Fji4y8NH ZzP/SL+XV62NqNVyp2gH85m3PaxqqXCpdBLrF8d6QGW7tAHcV0VUqdDk8oWE0aAa2bWJ wP/Q== MIME-Version: 1.0 Received: by 10.221.0.74 with SMTP id nl10mr5442813vcb.47.1350569127884; Thu, 18 Oct 2012 07:05:27 -0700 (PDT) Received: by 10.58.151.242 with HTTP; Thu, 18 Oct 2012 07:05:27 -0700 (PDT) In-Reply-To: References: Date: Thu, 18 Oct 2012 07:05:27 -0700 Message-ID: Subject: Re: Getting hostname (or any environment variable) into *-site.xml files From: Stephen Boesch To: user@hadoop.apache.org Content-Type: multipart/alternative; boundary=bcaec54fb0c21cb8dd04cc55e103 X-Virus-Checked: Checked by ClamAV on apache.org --bcaec54fb0c21cb8dd04cc55e103 Content-Type: text/plain; charset=ISO-8859-1 Thanks Harsh that is helpful and it does work. 2012/10/12 Harsh J > The ${FOO} stuff can be replaced via JVM System Properties. I just > explained this on another thread (a few mails ago). > > So if your "library" JVM had a system property of > -DHOSTNAME=donkeykong.com then ${HOSTNAME} will be replaced by > donkeykong.com automatically. > > Likewise, even using Tool as the entry point of your app will let you > achieve the same via regular -D args. > > Hope this helps! > > On Fri, Oct 12, 2012 at 7:07 PM, Stephen Boesch wrote: > > Hi, > > We are using a library with hdfs that uses custom properties inside > the > > *-site.xml files. Instead of (a) hard-coding or (b) writing a "sed" > script > > to update to the local hostnames on each deployed node, is there a > mechanism > > to use environment variables? > > > > > > custom.property > > ${HOSTNAME} > > > > > > > > I have tried this and out of the box the string ${HOSTNAME} is used. > Anyone > > have recommendation/solution on this? > > > > thanks, > > > > stephen b > > > > -- > Harsh J > --bcaec54fb0c21cb8dd04cc55e103 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks Harsh that is helpful and it does work.

2012/10/12 Harsh J <harsh@cloudera.com>
The ${FOO} stuff can be replaced via JVM System Properties. I just
explained this on another thread (a few mails ago).

So if your "library" JVM had a system property of
-DHOSTNAME=3Ddonkeykong= .com then ${HOSTNAME} will be replaced by
donkeykong.com auto= matically.

Likewise, even using Tool as the entry point of your app will let you
achieve the same via regular -D args.

Hope this helps!

On Fri, Oct 12, 2012 at 7:07 PM, Stephen Boesch <javadba@gmail.com> wrote:
> Hi,
> =A0 =A0We are using a library with hdfs that uses custom properties in= side the
> *-site.xml files. =A0Instead of (a) hard-coding or (b) writing a "= ;sed" script
> to update to the local hostnames on each deployed node, is there a mec= hanism
> to use environment variables?
>
> <property>
> <name>custom.property</name>
> <value>${HOSTNAME}</value>
> </property>
>
>
> I have tried this and out of the box the string ${HOSTNAME} is used. = =A0Anyone
> have recommendation/solution on this?
>
> thanks,
>
> stephen b



--
Harsh J

--bcaec54fb0c21cb8dd04cc55e103--