From ed55bcee1f932a94d58f6bd0633b8d625acf123d Mon Sep 17 00:00:00 2001 From: Akira Ajisaka Date: Tue, 7 Mar 2017 01:32:47 +0900 Subject: [PATCH] HADOOP-14108. CLI MiniCluster: add an option to specify NameNode HTTP port. Contributed by Takanobu Asanuma. (cherry picked from commit 209ecd1a5c056e096a5d804759f88302608d503b) --- .../hadoop-common/src/site/markdown/CLIMiniCluster.md.vm | 1 + .../apache/hadoop/mapreduce/MiniHadoopClusterManager.java | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/src/site/markdown/CLIMiniCluster.md.vm b/hadoop-common-project/hadoop-common/src/site/markdown/CLIMiniCluster.md.vm index 74c241400fa..806df0a41dc 100644 --- a/hadoop-common-project/hadoop-common/src/site/markdown/CLIMiniCluster.md.vm +++ b/hadoop-common-project/hadoop-common/src/site/markdown/CLIMiniCluster.md.vm @@ -55,6 +55,7 @@ There are a number of command line arguments that the users can use to control w $ -namenode URL of the namenode (default is either the DFS $ cluster or a temporary dir) $ -nnport NameNode port (default 0--we choose) + $ -nnhttpport NameNode HTTP port (default 0--we choose) $ -nodemanagers How many nodemanagers to start (default 1) $ -nodfs Don't start a mini DFS cluster $ -nomr Don't start a mini MR cluster diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/MiniHadoopClusterManager.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/MiniHadoopClusterManager.java index 2e8ba5e6270..96d00272939 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/MiniHadoopClusterManager.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/MiniHadoopClusterManager.java @@ -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 @@ public class MiniHadoopClusterManager { .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 class MiniHadoopClusterManager { 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 @@ public class MiniHadoopClusterManager { 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;