HADOOP-14108. CLI MiniCluster: add an option to specify NameNode HTTP port. Contributed by Takanobu Asanuma.

This commit is contained in:
Akira Ajisaka 2017-03-07 01:32:47 +09:00
parent 3536ce031c
commit 209ecd1a5c
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50
2 changed files with 7 additions and 1 deletions

View File

@ -55,6 +55,7 @@ There are a number of command line arguments that the users can use to control w
$ -namenode <arg> URL of the namenode (default is either the DFS
$ cluster or a temporary dir)
$ -nnport <arg> NameNode port (default 0--we choose)
$ -nnhttpport <arg> NameNode HTTP port (default 0--we choose)
$ -nodemanagers <arg> How many nodemanagers to start (default 1)
$ -nodfs Don't start a mini DFS cluster
$ -nomr Don't start a mini MR cluster

View File

@ -69,6 +69,7 @@ public class MiniHadoopClusterManager {
private int numNodeManagers;
private int numDataNodes;
private int nnPort;
private int nnHttpPort;
private int rmPort;
private int jhsPort;
private StartupOption dfsOpts;
@ -92,6 +93,8 @@ private Options makeOptions() {
.addOption("datanodes", true, "How many datanodes to start (default 1)")
.addOption("format", false, "Format the DFS (default false)")
.addOption("nnport", true, "NameNode port (default 0--we choose)")
.addOption("nnhttpport", true,
"NameNode HTTP port (default 0--we choose)")
.addOption(
"namenode",
true,
@ -152,7 +155,8 @@ public void start() throws IOException, FileNotFoundException,
URISyntaxException {
if (!noDFS) {
dfs = new MiniDFSCluster.Builder(conf).nameNodePort(nnPort)
.numDataNodes(numDataNodes).startupOption(dfsOpts).build();
.nameNodeHttpPort(nnHttpPort).numDataNodes(numDataNodes)
.startupOption(dfsOpts).build();
LOG.info("Started MiniDFSCluster -- namenode on port "
+ dfs.getNameNodePort());
}
@ -254,6 +258,7 @@ private boolean parseArguments(String[] args) {
noDFS = cli.hasOption("nodfs");
numDataNodes = intArgument(cli, "datanodes", 1);
nnPort = intArgument(cli, "nnport", 0);
nnHttpPort = intArgument(cli, "nnhttpport", 0);
dfsOpts = cli.hasOption("format") ? StartupOption.FORMAT
: StartupOption.REGULAR;