hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Zhang <zjf...@gmail.com>
Subject Re: How can I get system environment variable in core-site.xml
Date Thu, 11 Mar 2010 15:09:43 GMT
There's no such environment variable internally, But there's a work around.
Get the host name by using java api, and put the value into configuration,
just like this:

Configuration conf=new Configuration();
conf.set("hostname",InetAddress.getLocalHost().getHostName());

then you can use the ${hostname} in *-site.xml



On Thu, Mar 11, 2010 at 6:50 AM, Lu welman <welmanwenzi@gmail.com> wrote:

> Hi, all
>
> I saw that in *-site.xml, we can use ${user.name} to get the username of
> present user.
> If I want to get the environment $HOSTNAME, what should I do?
>
> I tried ${HOSTNAME}, ${env.hostname}, both of them can't work.
> It just return the string of "${HOSTNAME}" and "${env.hostname}"
> themselves.
>
> So can anybody tell me what I should use for get this environment?
> Thank you!
>
> welman Lu
>



-- 
Best Regards

Jeff Zhang

Mime
View raw message