HADOOP-14108. CLI MiniCluster: add an option to specify NameNode HTTP port. Contributed by Takanobu Asanuma.
This commit is contained in:
parent
3536ce031c
commit
209ecd1a5c
@ -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
|
$ -namenode <arg> URL of the namenode (default is either the DFS
|
||||||
$ cluster or a temporary dir)
|
$ cluster or a temporary dir)
|
||||||
$ -nnport <arg> NameNode port (default 0--we choose)
|
$ -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)
|
$ -nodemanagers <arg> How many nodemanagers to start (default 1)
|
||||||
$ -nodfs Don't start a mini DFS cluster
|
$ -nodfs Don't start a mini DFS cluster
|
||||||
$ -nomr Don't start a mini MR cluster
|
$ -nomr Don't start a mini MR cluster
|
||||||
|
@ -69,6 +69,7 @@ public class MiniHadoopClusterManager {
|
|||||||
private int numNodeManagers;
|
private int numNodeManagers;
|
||||||
private int numDataNodes;
|
private int numDataNodes;
|
||||||
private int nnPort;
|
private int nnPort;
|
||||||
|
private int nnHttpPort;
|
||||||
private int rmPort;
|
private int rmPort;
|
||||||
private int jhsPort;
|
private int jhsPort;
|
||||||
private StartupOption dfsOpts;
|
private StartupOption dfsOpts;
|
||||||
@ -92,6 +93,8 @@ private Options makeOptions() {
|
|||||||
.addOption("datanodes", true, "How many datanodes to start (default 1)")
|
.addOption("datanodes", true, "How many datanodes to start (default 1)")
|
||||||
.addOption("format", false, "Format the DFS (default false)")
|
.addOption("format", false, "Format the DFS (default false)")
|
||||||
.addOption("nnport", true, "NameNode port (default 0--we choose)")
|
.addOption("nnport", true, "NameNode port (default 0--we choose)")
|
||||||
|
.addOption("nnhttpport", true,
|
||||||
|
"NameNode HTTP port (default 0--we choose)")
|
||||||
.addOption(
|
.addOption(
|
||||||
"namenode",
|
"namenode",
|
||||||
true,
|
true,
|
||||||
@ -152,7 +155,8 @@ public void start() throws IOException, FileNotFoundException,
|
|||||||
URISyntaxException {
|
URISyntaxException {
|
||||||
if (!noDFS) {
|
if (!noDFS) {
|
||||||
dfs = new MiniDFSCluster.Builder(conf).nameNodePort(nnPort)
|
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 "
|
LOG.info("Started MiniDFSCluster -- namenode on port "
|
||||||
+ dfs.getNameNodePort());
|
+ dfs.getNameNodePort());
|
||||||
}
|
}
|
||||||
@ -254,6 +258,7 @@ private boolean parseArguments(String[] args) {
|
|||||||
noDFS = cli.hasOption("nodfs");
|
noDFS = cli.hasOption("nodfs");
|
||||||
numDataNodes = intArgument(cli, "datanodes", 1);
|
numDataNodes = intArgument(cli, "datanodes", 1);
|
||||||
nnPort = intArgument(cli, "nnport", 0);
|
nnPort = intArgument(cli, "nnport", 0);
|
||||||
|
nnHttpPort = intArgument(cli, "nnhttpport", 0);
|
||||||
dfsOpts = cli.hasOption("format") ? StartupOption.FORMAT
|
dfsOpts = cli.hasOption("format") ? StartupOption.FORMAT
|
||||||
: StartupOption.REGULAR;
|
: StartupOption.REGULAR;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user