public interface HadoopConfigConfigurer
HadoopConfigConfigurer
is an interface for HadoopConfigBuilder
which is
exposed to user via SpringHadoopConfigurerAdapter
.
Typically configuration is shown below.
@Configuration @EnableHadoop static class Config extends SpringHadoopConfigurerAdapter { @Override public void configure(HadoopConfigConfigurer config) throws Exception { config .fileSystemUri("hdfs://foo.uri") .withResources() .resource("classpath:/test-site-1.xml") .resource("classpath:/test-site-2.xml") .and() .withProperties() .property("foo", "jee"); } }
Modifier and Type | Method and Description |
---|---|
HadoopConfigConfigurer |
fileSystemUri(java.lang.String uri)
Specify a Hdfs file system uri.
|
HadoopConfigConfigurer |
jobHistoryAddress(java.lang.String address)
Specify a MapReduce job history address.
|
HadoopConfigConfigurer |
loadDefaults(boolean loadDefaults)
Specify if Hadoop
Configuration is initially
based on default values. |
HadoopConfigConfigurer |
resourceManagerAddress(java.lang.String address)
Specify a Yarn resource manager address.
|
PropertiesConfigurer<HadoopConfigConfigurer> |
withProperties()
Specify configuration options as properties with a
PropertiesConfigurer . |
ResourceConfigurer<HadoopConfigConfigurer> |
withResources()
Specify configuration options as resource properties with a
ResourceConfigurer . |
SecurityConfigurer<HadoopConfigConfigurer> |
withSecurity()
Specify security options with a
SecurityConfigurer . |
ResourceConfigurer<HadoopConfigConfigurer> withResources() throws java.lang.Exception
ResourceConfigurer
.
public void configure(HadoopConfigConfigurer config) throws Exception { Properties props = new Properties(); config .withResources() .resource("cfg-1.properties") .resource("cfg-2.properties") .and(); }
<hadoop:configuration properties-location="cfg-1.properties, cfg-2.properties"/>
ResourceConfigurer
for chainingjava.lang.Exception
- if error occurredPropertiesConfigurer<HadoopConfigConfigurer> withProperties() throws java.lang.Exception
PropertiesConfigurer
.
public void configure(HadoopConfigConfigurer config) throws Exception { Properties props = new Properties(); config .withProperties() .properties(props) .property("myKey1", ",myValue1") .and(); }
<util:properties id="props" location="props.properties"/> <prop key="myKey1">myValue1</prop> </util:properties> <hadoop:configuration properties-ref="props"/>
PropertiesConfigurer
for chainingjava.lang.Exception
- if error occurredSecurityConfigurer<HadoopConfigConfigurer> withSecurity() throws java.lang.Exception
SecurityConfigurer
.
JavaConfig:
public void configure(HadoopConfigConfigurer config) throws Exception { config .withSecurity() .authMethod("kerberos") .namenodePrincipal("hdfs/myhost@LOCALDOMAIN") .rmManagerPrincipal("yarn/myhost@LOCALDOMAIN"); }
XML:
No equivalent
SecurityConfigurer
for chainingjava.lang.Exception
- if error occurredHadoopConfigConfigurer fileSystemUri(java.lang.String uri)
public void configure(HadoopConfigConfigurer config) throws Exception { config .fileSystemUri("hdfs://myhost:8020"); }
<hadoop:configuration file-system-uri="hdfs://myhost:8020"/>
uri
- The Hdfs uriHadoopConfigConfigurer
for chainingHadoopConfigConfigurer resourceManagerAddress(java.lang.String address)
public void configure(HadoopConfigConfigurer config) throws Exception { config .resourceManagerAddress("myRmHost:8032"); }
<hadoop:configuration rm-manager-uri="myRmHost:8032"/>
address
- The Yarn resource manager addressHadoopConfigConfigurer
for chainingHadoopConfigConfigurer jobHistoryAddress(java.lang.String address)
public void configure(HadoopConfigConfigurer config) throws Exception { config .jobHistoryAddress("myJobHistoryHost:10020"); }
<hadoop:configuration job-history-uri="myJobHistoryHost:10020"/>
address
- The Yarn resource manager addressHadoopConfigConfigurer
for chainingHadoopConfigConfigurer loadDefaults(boolean loadDefaults)
Configuration
is initially
based on default values. Default is true
.
public void configure(HadoopConfigConfigurer config) throws Exception { config .loadDefaults(true); }
loadDefaults
- The flag if defaults should be loadedHadoopConfigConfigurer
for chaining