Database Reference
In-Depth Information
System . exit ( exitCode );
}
}
We make ConfigurationPrinter a subclass of Configured , which is an imple-
mentation of the Configurable interface. All implementations of Tool need to imple-
ment Configurable (since Tool extends it), and subclassing Configured is often
the easiest way to achieve this. The run() method obtains the Configuration using
Configurable 's getConf() method and then iterates over it, printing each property
to standard output.
The static block makes sure that the HDFS, YARN, and MapReduce configurations are
picked up, in addition to the core ones (which Configuration knows about already).
ConfigurationPrinter 's main() method does not invoke its own run() method
directly. Instead, we call ToolRunner 's static run() method, which takes care of cre-
ating a Configuration object for the Tool before calling its run() method.
ToolRunner also uses a GenericOptionsParser to pick up any standard options
specified on the command line and to set them on the Configuration instance. We
can see the effect of picking up the properties specified in conf/hadoop-localhost.xml by
running the following commands:
% mvn compile
% export HADOOP_CLASSPATH=target/classes/
% hadoop ConfigurationPrinter -conf conf/hadoop-localhost.xml \
| grep yarn.resourcemanager.address=
yarn.resourcemanager.address=localhost:8032
Search WWH ::




Custom Search