Example usage for org.apache.hadoop.hdfs.server.datanode DataNode instantiateDataNode

List of usage examples for org.apache.hadoop.hdfs.server.datanode DataNode instantiateDataNode

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.server.datanode DataNode instantiateDataNode.

Prototype

public static DataNode instantiateDataNode(String args[], Configuration conf) throws IOException 

Source Link

Document

Instantiate a single datanode object.

Usage

From source file:hudson.gridmaven.gridlayer.DataNodeStartTask.java

License:Open Source License

public Void call() throws IOException {
    System.out.println("Starting data node");
    //System.setProperty("java.net.preferIPv4Stack" , "true");
    Configuration conf = new Configuration();
    conf.set("fs.default.name", hdfsUrl);
    conf.set("dfs.data.dir", new File(new File(rootPath), "hadoop/datanode").getAbsolutePath());
    conf.set("dfs.datanode.address", "0.0.0.0:0");
    conf.set("dfs.datanode.http.address", "0.0.0.0:0");
    conf.set("dfs.datanode.ipc.address", "0.0.0.0:0");
    conf.set("slave.host.name", slaveHostName);
    conf.set("dfs.safemode.extension", "1");
    conf.set("dfs.namenode.logging.level", "ALL");
    conf.set("dfs.block.size", "1048576");
    // TODO: make this configurable
    // make room for builds
    conf.setLong("dfs.datanode.du.reserved", 1L * 1024 * 1024 * 1024);

    DataNode dn = DataNode.instantiateDataNode(new String[0], conf);
    DataNode.runDatanodeDaemon(dn);//from w  w  w.  ja v  a2  s  .  c om

    return null;
}

From source file:hudson.plugins.hadoop.DataNodeStartTask.java

License:Open Source License

public Void call() throws IOException {
    System.out.println("Starting data node");

    Configuration conf = new Configuration();
    conf.set("fs.default.name", hdfsUrl);
    conf.set("dfs.data.dir", new File(new File(rootPath), "hadoop/datanode").getAbsolutePath());
    conf.set("dfs.datanode.address", "0.0.0.0:0");
    conf.set("dfs.datanode.http.address", "0.0.0.0:0");
    conf.set("dfs.datanode.ipc.address", "0.0.0.0:0");
    conf.set("slave.host.name", slaveHostName);

    // TODO: make this configurable
    // make room for builds
    conf.setLong("dfs.datanode.du.reserved", 10L * 1024 * 1024 * 1024);

    DataNode dn = DataNode.instantiateDataNode(new String[0], conf);
    DataNode.runDatanodeDaemon(dn);//  w w  w  . ja  v a2  s.c om

    return null;
}