* Even if told to use the configuration properties for dfs.datanode,
* MiniDFSCluster.startDataNodes() should use localhost as the default if
* the dfs.datanode properties are not set.
*------------------------------------------------------------------------*/
for (int i = 0; i < dns.size(); i++) {
DataNodeProperties dnp = cluster.stopDataNode(i);
assertNotNull("Should have been able to stop simulated datanode", dnp);
}
conf.unset("dfs.datanode.address");
conf.unset("dfs.datanode.http.address");
conf.unset("dfs.datanode.ipc.address");
cluster.startDataNodes(conf, 1, true, StartupOption.REGULAR,
null, null, null, false, true);
dns = cluster.getDataNodes();
dn = dns.get(0);
selfSocketAddr = dn.getSelfAddr().toString();
System.out.println("DN Self Socket Addr == " + selfSocketAddr);
// assert that default self socket address is 127.0.0.1
assertTrue(selfSocketAddr.startsWith("/127.0.0.1:"));
/*-------------------------------------------------------------------------
* Shut down the datanodes, reconfigure, and bring them back up.
* This time, modify the dfs.datanode properties and make sure that they
* are used to configure sockets by MiniDFSCluster.startDataNodes().
*------------------------------------------------------------------------*/
for (int i = 0; i < dns.size(); i++) {
DataNodeProperties dnp = cluster.stopDataNode(i);
assertNotNull("Should have been able to stop simulated datanode", dnp);
}
conf.set("dfs.datanode.address","0.0.0.0:0");
conf.set("dfs.datanode.http.address","0.0.0.0:0");