public static void main(String[] args) throws Exception { Configuration.addDefaultResource("hdfs-default.xml"); Configuration.addDefaultResource("hdfs-site.xml"); Crush crusher = new Crush(); int exitCode = ToolRunner.run(crusher, args); System.exit(exitCode); }
static { try { Configuration.addDefaultResource("hdfs-default.xml"); Configuration.addDefaultResource("hdfs-site.xml"); Configuration.addDefaultResource("erasure-coding-default.xml"); Configuration.addDefaultResource("erasure-coding-site.xml"); initializeCodecs(new Configuration()); } catch (Exception e) { throw new RuntimeException("Failed to initialize erasure coding codecs", e); } }
// create a resource file with the new settings private void addNewConfigResource( String rsrcName, String keyGroup, String groups, String keyHosts, String hosts) throws FileNotFoundException { // location for temp resource should be in CLASSPATH String dir = System.getProperty("test.build.extraconf", "build/test/extraconf"); tempResource = dir.toString() + "/" + rsrcName; String newResource = "<configuration>" + "<property><name>" + keyGroup + "</name><value>" + groups + "</value></property>" + "<property><name>" + keyHosts + "</name><value>" + hosts + "</value></property>" + "</configuration>"; PrintWriter writer = new PrintWriter(new FileOutputStream(tempResource)); writer.println(newResource); writer.close(); Configuration.addDefaultResource(rsrcName); }
static { // Load the XML config defined in hadoop-local.xml Configuration.addDefaultResource("src/examples/hadoop-local.xml"); Configuration.addDefaultResource("src/examples/mongo-defaults.xml"); }
public void setConf(Configuration conf) { this.conf = conf; Configuration.addDefaultResource(CLUSTER_BALANCER_CONF_FILE); }
static { Configuration.addDefaultResource("hdfs-default.xml"); Configuration.addDefaultResource("hdfs-site.xml"); Configuration.addDefaultResource("mapred-default.xml"); Configuration.addDefaultResource("mapred-site.xml"); }
static { Configuration.addDefaultResource(YARN_DEFAULT_XML_FILE); Configuration.addDefaultResource(YARN_SITE_XML_FILE); }