LOG.info("Adding node with hostname : " + name + " to rack "
+ racks[i]);
StaticMapping.addNodeToRack(name, racks[i]);
}
Configuration newconf = new Configuration(dnConf); // save config
AvatarDataNode dn = instantiateDataNode(dnArgs, dnConf);
// since the HDFS does things based on IP:port, we need to add the
// mapping
// for IP:port to rackId
String ipAddr = dn.getSelfAddr().getAddress().getHostAddress();
if (racks != null) {
int port = dn.getSelfAddr().getPort();
System.out.println("Adding node with IP:port : " + ipAddr + ":"
+ port + " to rack " + racks[i]);
StaticMapping.addNodeToRack(ipAddr + ":" + port, racks[i]);
}
dn.runDatanodeDaemon();
synchronized (dataNodes) {
dataNodes.add(new DataNodeProperties(dn, newconf, dnArgs));
}
} catch (IOException e) {
LOG.error("Exception when creating datanode", e);