List of usage examples for org.apache.hadoop.hdfs MiniDFSNNTopology simpleSingleNN
public static MiniDFSNNTopology simpleSingleNN(int nameNodePort, int nameNodeHttpPort)
From source file:com.mellanox.r4h.MiniDFSCluster.java
License:Apache License
/** * Used by builder to create and return an instance of MiniDFSCluster *//*w ww . j a va 2s .c om*/ protected MiniDFSCluster(Builder builder) throws IOException { if (builder.nnTopology == null) { // If no topology is specified, build a single NN. builder.nnTopology = MiniDFSNNTopology.simpleSingleNN(builder.nameNodePort, builder.nameNodeHttpPort); } final int numNameNodes = builder.nnTopology.countNameNodes(); LOG.info("starting cluster: numNameNodes=" + numNameNodes + ", numDataNodes=" + builder.numDataNodes); nameNodes = new NameNodeInfo[numNameNodes]; initMiniDFSCluster(builder.conf, builder.numDataNodes, builder.storageType, builder.format, builder.manageNameDfsDirs, builder.manageNameDfsSharedDirs, builder.enableManagedDfsDirsRedundancy, builder.manageDataDfsDirs, builder.option, builder.dnOption, builder.racks, builder.hosts, builder.simulatedCapacities, builder.clusterId, builder.waitSafeMode, builder.setupHostsFile, builder.nnTopology, builder.checkExitOnShutdown, builder.checkDataNodeAddrConfig, builder.checkDataNodeHostConfig, builder.dnConfOverlays); }
From source file:com.mellanox.r4h.MiniDFSCluster.java
License:Apache License
/** * NOTE: if possible, the other constructors that don't have nameNode port * parameter should be used as they will ensure that the servers use free ports. * <p>/* w w w. j a va2s.c o m*/ * Modify the config and start up the servers. * * @param nameNodePort * suggestion for which rpc port to use. caller should * use getNameNodePort() to get the actual port used. * @param conf * the base configuration to use in starting the servers. This * will be modified as necessary. * @param numDataNodes * Number of DataNodes to start; may be zero * @param format * if true, format the NameNode and DataNodes before starting up * @param manageNameDfsDirs * if true, the data directories for servers will be * created and {@link #DFS_NAMENODE_NAME_DIR_KEY} and {@link #DFS_DATANODE_DATA_DIR_KEY} will be set in * the conf * @param manageDataDfsDirs * if true, the data directories for datanodes will * be created and {@link #DFS_DATANODE_DATA_DIR_KEY} set to same in the conf * @param operation * the operation with which to start the servers. If null * or StartupOption.FORMAT, then StartupOption.REGULAR will be used. * @param racks * array of strings indicating the rack that each DataNode is on * @param hosts * array of strings indicating the hostnames of each DataNode * @param simulatedCapacities * array of capacities of the simulated data nodes */ @Deprecated // in 22 to be removed in 24. Use MiniDFSCluster.Builder instead public MiniDFSCluster(int nameNodePort, Configuration conf, int numDataNodes, boolean format, boolean manageNameDfsDirs, boolean manageDataDfsDirs, StartupOption operation, String[] racks, String hosts[], long[] simulatedCapacities) throws IOException { this.nameNodes = new NameNodeInfo[1]; // Single namenode in the cluster initMiniDFSCluster(conf, numDataNodes, StorageType.DEFAULT, format, manageNameDfsDirs, true, manageDataDfsDirs, manageDataDfsDirs, operation, null, racks, hosts, simulatedCapacities, null, true, false, MiniDFSNNTopology.simpleSingleNN(nameNodePort, 0), true, false, false, null); }