Browse Source

HDFS-5928. Show namespace and namenode ID on NN dfshealth page. Contributed by Siqi Li.

Haohui Mai 10 năm trước cách đây
mục cha
commit
0e05624618

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -53,6 +53,9 @@ Release 2.7.0 - UNRELEASED
     HDFS-7283. Bump DataNode OOM log from WARN to ERROR.
     (Stephen Chu via wheat9)
 
+    HDFS-5928. Show namespace and namenode ID on NN dfshealth page.
+    (Siqi Li via wheat9)
+
   OPTIMIZATIONS
 
   BUG FIXES

+ 7 - 2
hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html

@@ -116,15 +116,20 @@
 {/nn}
 
 <div class="page-header"><h1>Overview {#nnstat}<small>'{HostAndPort}' ({State})</small>{/nnstat}</h1></div>
-{#nn}
+
 <table class="table table-bordered table-striped">
+{#HAInfo}
+  <tr><th>Namespace:</th><td>{Namespace}</td></tr>
+  <tr><th>Namenode ID:</th><td>{NamenodeID}</td></tr>
+{/HAInfo}
+{#nn}
   <tr><th>Started:</th><td>{NNStarted}</td></tr>
   <tr><th>Version:</th><td>{Version}</td></tr>
   <tr><th>Compiled:</th><td>{CompileInfo}</td></tr>
   <tr><th>Cluster ID:</th><td>{ClusterId}</td></tr>
   <tr><th>Block Pool ID:</th><td>{BlockPoolId}</td></tr>
-</table>
 {/nn}
+</table>
 
 <div class="page-header"><h1>Summary</h1></div>
 <p>

+ 17 - 0
hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js

@@ -54,6 +54,23 @@
 
     var data = {};
 
+    $.ajax({'url': '/conf', 'dataType': 'xml', 'async': false}).done(
+      function(d) {
+        var $xml = $(d);
+        var namespace, nnId;
+        $xml.find('property').each(function(idx,v) {
+          if ($(v).find('name').text() === 'dfs.nameservice.id') {
+            namespace = $(v).find('value').text();
+          }
+          if ($(v).find('name').text() === 'dfs.ha.namenode.id') {
+            nnId = $(v).find('value').text();
+          }
+        });
+        if (namespace && nnId) {
+          data['HAInfo'] = {"Namespace": namespace, "NamenodeID": nnId};
+        }
+    });
+
     // Workarounds for the fact that JMXJsonServlet returns non-standard JSON strings
     function workaround(nn) {
       nn.JournalTransactionInfo = JSON.parse(nn.JournalTransactionInfo);