hadoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harsh J <ha...@cloudera.com>
Subject Re: GenericOptionsParser
Date Wed, 03 Oct 2012 17:47:37 GMT
Koert,

System properties ought to go to JVM args directly. Use
HADOOP_CLIENT_OPTS to pass those -Ds. This is cause System properties
is a JVM-level concept and "java" is the utility that accepts those.
We provide a wrapper in form of "hadoop jar".

GenericOptionsParser (i.e. Tool - Don't use GOP directly) parses
in-app args (i.e. the args in main(String... args) of a Java program)
and offers a famililar "-Dprop=value format for Configuration object
setting strings.

The "hadoop jar" runs a utility called RunJar to launch the real
jar/class passed as an argument to it, so that won't be a good place
to set the config params at, as you propose, cause it will be missed
when the real app class loads and executes.

It would also be dangerous of Configuration or GOP to try to edit the
JVM's System properties based on the Configuration's values.

So you may do:

~ HADOOP_CLIENT_OPTS="-Dmysysprops=foobar -Dfoo2=bar2" hadoop jar <program>

(Or if that doesn't work for some reason on your version - I tested
only on 2.x):

~ HADOOP_OPTS="-Dmysysprops=foobar -Dfoo2=bar2" hadoop jar <program>

On Wed, Oct 3, 2012 at 11:08 PM, Koert Kuipers <koert@tresata.com> wrote:
> Why does GenericOptionParser also remove -Dprop=value options (without
> setting the system properties)? Those are not hadoop options but java
> options. And why does hadoop jar not accept -Dprop=value before the class
> name, as java does? like "hadoop jar -Dprop=value class"
> How do i set java system properties with hadoop jar?
> Thx! Koert



-- 
Harsh J

Mime
View raw message