|
@@ -419,6 +419,7 @@ public class DFSAdmin extends FsShell {
|
|
"\t[-refreshNamenodes datanode_host:ipc_port]\n"+
|
|
"\t[-refreshNamenodes datanode_host:ipc_port]\n"+
|
|
"\t[-deleteBlockPool datanode_host:ipc_port blockpoolId [force]]\n"+
|
|
"\t[-deleteBlockPool datanode_host:ipc_port blockpoolId [force]]\n"+
|
|
"\t[-setBalancerBandwidth <bandwidth in bytes per second>]\n" +
|
|
"\t[-setBalancerBandwidth <bandwidth in bytes per second>]\n" +
|
|
|
|
+ "\t[-getBalancerBandwidth <datanode_host:ipc_port>]\n" +
|
|
"\t[-fetchImage <local directory>]\n" +
|
|
"\t[-fetchImage <local directory>]\n" +
|
|
"\t[-allowSnapshot <snapshotDir>]\n" +
|
|
"\t[-allowSnapshot <snapshotDir>]\n" +
|
|
"\t[-disallowSnapshot <snapshotDir>]\n" +
|
|
"\t[-disallowSnapshot <snapshotDir>]\n" +
|
|
@@ -887,6 +888,26 @@ public class DFSAdmin extends FsShell {
|
|
return exitCode;
|
|
return exitCode;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Command to get balancer bandwidth for the given datanode. Usage: hdfs
|
|
|
|
+ * dfsadmin -getBalancerBandwidth {@literal <datanode_host:ipc_port>}
|
|
|
|
+ * @param argv List of of command line parameters.
|
|
|
|
+ * @param idx The index of the command that is being processed.
|
|
|
|
+ * @exception IOException
|
|
|
|
+ */
|
|
|
|
+ public int getBalancerBandwidth(String[] argv, int idx) throws IOException {
|
|
|
|
+ ClientDatanodeProtocol dnProxy = getDataNodeProxy(argv[idx]);
|
|
|
|
+ try {
|
|
|
|
+ long bandwidth = dnProxy.getBalancerBandwidth();
|
|
|
|
+ System.out.println("Balancer bandwidth is " + bandwidth
|
|
|
|
+ + " bytes per second.");
|
|
|
|
+ } catch (IOException ioe) {
|
|
|
|
+ System.err.println("Datanode unreachable.");
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Download the most recent fsimage from the name node, and save it to a local
|
|
* Download the most recent fsimage from the name node, and save it to a local
|
|
* file in the given directory.
|
|
* file in the given directory.
|
|
@@ -1025,7 +1046,13 @@ public class DFSAdmin extends FsShell {
|
|
"\t\tthat will be used by each datanode. This value overrides\n" +
|
|
"\t\tthat will be used by each datanode. This value overrides\n" +
|
|
"\t\tthe dfs.balance.bandwidthPerSec parameter.\n\n" +
|
|
"\t\tthe dfs.balance.bandwidthPerSec parameter.\n\n" +
|
|
"\t\t--- NOTE: The new value is not persistent on the DataNode.---\n";
|
|
"\t\t--- NOTE: The new value is not persistent on the DataNode.---\n";
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ String getBalancerBandwidth = "-getBalancerBandwidth <datanode_host:ipc_port>:\n" +
|
|
|
|
+ "\tGet the network bandwidth for the given datanode.\n" +
|
|
|
|
+ "\tThis is the maximum network bandwidth used by the datanode\n" +
|
|
|
|
+ "\tduring HDFS block balancing.\n\n" +
|
|
|
|
+ "\t--- NOTE: This value is not persistent on the DataNode.---\n";
|
|
|
|
+
|
|
String fetchImage = "-fetchImage <local directory>:\n" +
|
|
String fetchImage = "-fetchImage <local directory>:\n" +
|
|
"\tDownloads the most recent fsimage from the Name Node and saves it in" +
|
|
"\tDownloads the most recent fsimage from the Name Node and saves it in" +
|
|
"\tthe specified local directory.\n";
|
|
"\tthe specified local directory.\n";
|
|
@@ -1103,6 +1130,8 @@ public class DFSAdmin extends FsShell {
|
|
System.out.println(deleteBlockPool);
|
|
System.out.println(deleteBlockPool);
|
|
} else if ("setBalancerBandwidth".equals(cmd)) {
|
|
} else if ("setBalancerBandwidth".equals(cmd)) {
|
|
System.out.println(setBalancerBandwidth);
|
|
System.out.println(setBalancerBandwidth);
|
|
|
|
+ } else if ("getBalancerBandwidth".equals(cmd)) {
|
|
|
|
+ System.out.println(getBalancerBandwidth);
|
|
} else if ("fetchImage".equals(cmd)) {
|
|
} else if ("fetchImage".equals(cmd)) {
|
|
System.out.println(fetchImage);
|
|
System.out.println(fetchImage);
|
|
} else if ("allowSnapshot".equalsIgnoreCase(cmd)) {
|
|
} else if ("allowSnapshot".equalsIgnoreCase(cmd)) {
|
|
@@ -1140,6 +1169,7 @@ public class DFSAdmin extends FsShell {
|
|
System.out.println(refreshNamenodes);
|
|
System.out.println(refreshNamenodes);
|
|
System.out.println(deleteBlockPool);
|
|
System.out.println(deleteBlockPool);
|
|
System.out.println(setBalancerBandwidth);
|
|
System.out.println(setBalancerBandwidth);
|
|
|
|
+ System.out.println(getBalancerBandwidth);
|
|
System.out.println(fetchImage);
|
|
System.out.println(fetchImage);
|
|
System.out.println(allowSnapshot);
|
|
System.out.println(allowSnapshot);
|
|
System.out.println(disallowSnapshot);
|
|
System.out.println(disallowSnapshot);
|
|
@@ -1682,6 +1712,9 @@ public class DFSAdmin extends FsShell {
|
|
} else if ("-setBalancerBandwidth".equals(cmd)) {
|
|
} else if ("-setBalancerBandwidth".equals(cmd)) {
|
|
System.err.println("Usage: hdfs dfsadmin"
|
|
System.err.println("Usage: hdfs dfsadmin"
|
|
+ " [-setBalancerBandwidth <bandwidth in bytes per second>]");
|
|
+ " [-setBalancerBandwidth <bandwidth in bytes per second>]");
|
|
|
|
+ } else if ("-getBalancerBandwidth".equalsIgnoreCase(cmd)) {
|
|
|
|
+ System.err.println("Usage: hdfs dfsadmin"
|
|
|
|
+ + " [-getBalancerBandwidth <datanode_host:ipc_port>]");
|
|
} else if ("-fetchImage".equals(cmd)) {
|
|
} else if ("-fetchImage".equals(cmd)) {
|
|
System.err.println("Usage: hdfs dfsadmin"
|
|
System.err.println("Usage: hdfs dfsadmin"
|
|
+ " [-fetchImage <local directory>]");
|
|
+ " [-fetchImage <local directory>]");
|
|
@@ -1817,6 +1850,11 @@ public class DFSAdmin extends FsShell {
|
|
printUsage(cmd);
|
|
printUsage(cmd);
|
|
return exitCode;
|
|
return exitCode;
|
|
}
|
|
}
|
|
|
|
+ } else if ("-getBalancerBandwidth".equalsIgnoreCase(cmd)) {
|
|
|
|
+ if (argv.length != 2) {
|
|
|
|
+ printUsage(cmd);
|
|
|
|
+ return exitCode;
|
|
|
|
+ }
|
|
} else if ("-fetchImage".equals(cmd)) {
|
|
} else if ("-fetchImage".equals(cmd)) {
|
|
if (argv.length != 2) {
|
|
if (argv.length != 2) {
|
|
printUsage(cmd);
|
|
printUsage(cmd);
|
|
@@ -1902,6 +1940,8 @@ public class DFSAdmin extends FsShell {
|
|
exitCode = deleteBlockPool(argv, i);
|
|
exitCode = deleteBlockPool(argv, i);
|
|
} else if ("-setBalancerBandwidth".equals(cmd)) {
|
|
} else if ("-setBalancerBandwidth".equals(cmd)) {
|
|
exitCode = setBalancerBandwidth(argv, i);
|
|
exitCode = setBalancerBandwidth(argv, i);
|
|
|
|
+ } else if ("-getBalancerBandwidth".equals(cmd)) {
|
|
|
|
+ exitCode = getBalancerBandwidth(argv, i);
|
|
} else if ("-fetchImage".equals(cmd)) {
|
|
} else if ("-fetchImage".equals(cmd)) {
|
|
exitCode = fetchImage(argv, i);
|
|
exitCode = fetchImage(argv, i);
|
|
} else if ("-shutdownDatanode".equals(cmd)) {
|
|
} else if ("-shutdownDatanode".equals(cmd)) {
|