|
@@ -433,7 +433,7 @@ public class DFSAdmin extends FsShell {
|
|
*/
|
|
*/
|
|
private static final String commonUsageSummary =
|
|
private static final String commonUsageSummary =
|
|
"\t[-report [-live] [-dead] [-decommissioning] " +
|
|
"\t[-report [-live] [-dead] [-decommissioning] " +
|
|
- "[-enteringmaintenance] [-inmaintenance]]\n" +
|
|
|
|
|
|
+ "[-enteringmaintenance] [-inmaintenance] [-slownodes]]\n" +
|
|
"\t[-safemode <enter | leave | get | wait | forceExit>]\n" +
|
|
"\t[-safemode <enter | leave | get | wait | forceExit>]\n" +
|
|
"\t[-saveNamespace [-beforeShutdown]]\n" +
|
|
"\t[-saveNamespace [-beforeShutdown]]\n" +
|
|
"\t[-rollEdits]\n" +
|
|
"\t[-rollEdits]\n" +
|
|
@@ -587,11 +587,13 @@ public class DFSAdmin extends FsShell {
|
|
StringUtils.popOption("-enteringmaintenance", args);
|
|
StringUtils.popOption("-enteringmaintenance", args);
|
|
final boolean listInMaintenance =
|
|
final boolean listInMaintenance =
|
|
StringUtils.popOption("-inmaintenance", args);
|
|
StringUtils.popOption("-inmaintenance", args);
|
|
|
|
+ final boolean listSlowNodes =
|
|
|
|
+ StringUtils.popOption("-slownodes", args);
|
|
|
|
|
|
|
|
|
|
// If no filter flags are found, then list all DN types
|
|
// If no filter flags are found, then list all DN types
|
|
boolean listAll = (!listLive && !listDead && !listDecommissioning
|
|
boolean listAll = (!listLive && !listDead && !listDecommissioning
|
|
- && !listEnteringMaintenance && !listInMaintenance);
|
|
|
|
|
|
+ && !listEnteringMaintenance && !listInMaintenance && !listSlowNodes);
|
|
|
|
|
|
if (listAll || listLive) {
|
|
if (listAll || listLive) {
|
|
printDataNodeReports(dfs, DatanodeReportType.LIVE, listLive, "Live");
|
|
printDataNodeReports(dfs, DatanodeReportType.LIVE, listLive, "Live");
|
|
@@ -615,6 +617,10 @@ public class DFSAdmin extends FsShell {
|
|
printDataNodeReports(dfs, DatanodeReportType.IN_MAINTENANCE,
|
|
printDataNodeReports(dfs, DatanodeReportType.IN_MAINTENANCE,
|
|
listInMaintenance, "In maintenance");
|
|
listInMaintenance, "In maintenance");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (listAll || listSlowNodes) {
|
|
|
|
+ printSlowDataNodeReports(dfs, listSlowNodes, "Slow");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private static void printDataNodeReports(DistributedFileSystem dfs,
|
|
private static void printDataNodeReports(DistributedFileSystem dfs,
|
|
@@ -632,6 +638,20 @@ public class DFSAdmin extends FsShell {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private static void printSlowDataNodeReports(DistributedFileSystem dfs, boolean listNodes,
|
|
|
|
+ String nodeState) throws IOException {
|
|
|
|
+ DatanodeInfo[] nodes = dfs.getSlowDatanodeStats();
|
|
|
|
+ if (nodes.length > 0 || listNodes) {
|
|
|
|
+ System.out.println(nodeState + " datanodes (" + nodes.length + "):\n");
|
|
|
|
+ }
|
|
|
|
+ if (nodes.length > 0) {
|
|
|
|
+ for (DatanodeInfo dn : nodes) {
|
|
|
|
+ System.out.println(dn.getDatanodeReport());
|
|
|
|
+ System.out.println();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Safe mode maintenance command.
|
|
* Safe mode maintenance command.
|
|
* Usage: hdfs dfsadmin -safemode [enter | leave | get | wait | forceExit]
|
|
* Usage: hdfs dfsadmin -safemode [enter | leave | get | wait | forceExit]
|
|
@@ -1148,7 +1168,7 @@ public class DFSAdmin extends FsShell {
|
|
commonUsageSummary;
|
|
commonUsageSummary;
|
|
|
|
|
|
String report ="-report [-live] [-dead] [-decommissioning] "
|
|
String report ="-report [-live] [-dead] [-decommissioning] "
|
|
- + "[-enteringmaintenance] [-inmaintenance]:\n" +
|
|
|
|
|
|
+ + "[-enteringmaintenance] [-inmaintenance] [-slownodes]:\n" +
|
|
"\tReports basic filesystem information and statistics. \n" +
|
|
"\tReports basic filesystem information and statistics. \n" +
|
|
"\tThe dfs usage can be different from \"du\" usage, because it\n" +
|
|
"\tThe dfs usage can be different from \"du\" usage, because it\n" +
|
|
"\tmeasures raw space used by replication, checksums, snapshots\n" +
|
|
"\tmeasures raw space used by replication, checksums, snapshots\n" +
|
|
@@ -2126,7 +2146,7 @@ public class DFSAdmin extends FsShell {
|
|
if ("-report".equals(cmd)) {
|
|
if ("-report".equals(cmd)) {
|
|
System.err.println("Usage: hdfs dfsadmin"
|
|
System.err.println("Usage: hdfs dfsadmin"
|
|
+ " [-report] [-live] [-dead] [-decommissioning]"
|
|
+ " [-report] [-live] [-dead] [-decommissioning]"
|
|
- + " [-enteringmaintenance] [-inmaintenance]");
|
|
|
|
|
|
+ + " [-enteringmaintenance] [-inmaintenance] [-slownodes]");
|
|
} else if ("-safemode".equals(cmd)) {
|
|
} else if ("-safemode".equals(cmd)) {
|
|
System.err.println("Usage: hdfs dfsadmin"
|
|
System.err.println("Usage: hdfs dfsadmin"
|
|
+ " [-safemode enter | leave | get | wait | forceExit]");
|
|
+ " [-safemode enter | leave | get | wait | forceExit]");
|