HDFS-5748. Merging change r1560215 from trunk

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1560216 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brandon Li 2014-01-21 22:59:29 +00:00
parent 033d60a28f
commit dd5de5a756
4 changed files with 338 additions and 274 deletions

View File

@ -285,6 +285,9 @@ Release 2.4.0 - UNRELEASED
HDFS-5800. Fix a typo in DFSClient.renewLease(). (Kousuke Saruta HDFS-5800. Fix a typo in DFSClient.renewLease(). (Kousuke Saruta
via szetszwo) via szetszwo)
HDFS-5748. Too much information shown in the dfs health page.
(Haohui Mai via brandonli)
BREAKDOWN OF HDFS-2832 SUBTASKS AND RELATED JIRAS BREAKDOWN OF HDFS-2832 SUBTASKS AND RELATED JIRAS
HDFS-4985. Add storage type to the protocol and expose it in block report HDFS-4985. Add storage type to the protocol and expose it in block report

View File

@ -23,25 +23,53 @@
<title>Namenode information</title> <title>Namenode information</title>
</head> </head>
<body> <body>
<header class="navbar navbar-inverse bs-docs-nav" role="banner">
<div class="container"> <div class="container">
<div class="alert alert-danger" id="alert-panel" style="display:none"> <div class="navbar-header">
<a href="http://hadoop.apache.org/core" class="navbar-brand">Hadoop</a>
</div>
<ul class="nav navbar-nav" id="ui-tabs">
<li><a href="#tab-overview">Overview</a></li>
<li><a href="#tab-datanode">Datanodes</a></li>
<li><a href="#tab-snapshot">Snapshot</a></li>
<li><a href="#tab-startup-progress">Startup Progress</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Utilities <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="explorer.html">Browse the file system</a></li>
<li><a href="logs">Logs</a></li>
</ul>
</li>
</ul>
</div>
</header>
<div class="container">
<div id="alert-panel">
<div class="alert alert-danger">
<button type="button" class="close" onclick="$('#alert-panel').hide();">&times;</button> <button type="button" class="close" onclick="$('#alert-panel').hide();">&times;</button>
<div class="alert-body" id="alert-panel-body"></div> <div class="alert-body" id="alert-panel-body"></div>
</div> </div>
<div id="panel"></div>
</div> </div>
<div class="tab-content">
<div class="tab-pane" id="tab-overview"></div>
<div class="tab-pane" id="tab-datanode"></div>
<div class="tab-pane" id="tab-snapshot"></div>
<div class="tab-pane" id="tab-startup-progress"></div>
</div>
<div class="row"> <div class="row">
<hr /> <hr />
<div class="col-xs-2"><p><a href="http://hadoop.apache.org/core">Hadoop</a>, 2013.</p></div> <div class="col-xs-2"><p><a href="http://hadoop.apache.org/core">Hadoop</a>, 2014.</p></div>
<div class="col-xs-1 pull-right"><a style="color: #ddd" href="dfshealth.jsp">Legacy UI</a></div> <div class="col-xs-1 pull-right"><a style="color: #ddd" href="dfshealth.jsp">Legacy UI</a></div>
</div> </div>
</div>
<script type="text/x-dust-template" id="tmpl-dfshealth"> <script type="text/x-dust-template" id="tmpl-dfshealth">
<div class="page-header">
{#nnstat}
<h1>NameNode '{HostAndPort}' ({State})</h1>
{/nnstat}
</div>
{#nn} {#nn}
{@if cond="{DistinctVersionCount} > 1"} {@if cond="{DistinctVersionCount} > 1"}
@ -71,11 +99,9 @@
{/if} {/if}
{/nn} {/nn}
<div class="panel panel-success"> <div class="page-header"><h1>Overview {#nnstat}<small>'{HostAndPort}' ({State})</small>{/nnstat}</h1></div>
<div class="panel-heading">Overview</div>
<div class="panel-body">
{#nn} {#nn}
<table class="table table-bordered"> <table class="table table-bordered table-striped">
<tr><th>Started:</th><td>{NNStarted}</td></tr> <tr><th>Started:</th><td>{NNStarted}</td></tr>
<tr><th>Version:</th><td>{Version}</td></tr> <tr><th>Version:</th><td>{Version}</td></tr>
<tr><th>Compiled:</th><td>{CompileInfo}</td></tr> <tr><th>Compiled:</th><td>{CompileInfo}</td></tr>
@ -83,18 +109,8 @@
<tr><th>Block Pool ID:</th><td>{BlockPoolId}</td></tr> <tr><th>Block Pool ID:</th><td>{BlockPoolId}</td></tr>
</table> </table>
{/nn} {/nn}
</div>
</div>
<p><a href="explorer.html">Browse the filesystem</a></p>
<p><a href="/logs/">NameNode Logs</a></p>
<hr/>
<div class="panel panel-success">
<div class="panel-heading">Cluster Summary</div>
<div class="panel-body">
<div class="page-header"><h1>Summary</h1></div>
<p> <p>
Security is {#nnstat}{#SecurityEnabled}on{:else}off{/SecurityEnabled}{/nnstat}.</p> Security is {#nnstat}{#SecurityEnabled}on{:else}off{/SecurityEnabled}{/nnstat}.</p>
<p>{#nn}{#Safemode}{.}{:else}Safemode is off.{/Safemode}{/nn}</p> <p>{#nn}{#Safemode}{.}{:else}Safemode is off.{/Safemode}{/nn}</p>
@ -128,19 +144,14 @@
{/nn} {/nn}
{#fs} {#fs}
<tr><th><a href="#nodelist-operation">Live Nodes</a></th><td>{NumLiveDataNodes} (Decommissioned: {NumDecomLiveDataNodes})</td></tr> <tr><th><a href="#tab-datanode">Live Nodes</a></th><td>{NumLiveDataNodes} (Decommissioned: {NumDecomLiveDataNodes})</td></tr>
<tr><th><a href="#nodelist-operation">Dead Nodes</a></th><td>{NumDeadDataNodes} (Decommissioned: {NumDecomDeadDataNodes})</td></tr> <tr><th><a href="#tab-datanode">Dead Nodes</a></th><td>{NumDeadDataNodes} (Decommissioned: {NumDecomDeadDataNodes})</td></tr>
<tr><th><a href="#nodelist-decom">Decommissioning Nodes</a></th><td>{NumDecommissioningDataNodes}</td></tr> <tr><th><a href="#tab-datanode">Decommissioning Nodes</a></th><td>{NumDecommissioningDataNodes}</td></tr>
<tr><th title="Excludes missing blocks.">Number of Under-Replicated Blocks</th><td>{UnderReplicatedBlocks}</td></tr> <tr><th title="Excludes missing blocks.">Number of Under-Replicated Blocks</th><td>{UnderReplicatedBlocks}</td></tr>
{/fs} {/fs}
</table> </table>
</div>
</div>
<hr/> <div class="page-header"><h1>Namenode Journal Status</h1></div>
<div class="panel panel-success">
<div class="panel-heading">NameNode Journal Status</div>
<div class="panel-body">
<p><b>Current transaction ID:</b> {nn.JournalTransactionInfo.LastAppliedOrWrittenTxId}</p> <p><b>Current transaction ID:</b> {nn.JournalTransactionInfo.LastAppliedOrWrittenTxId}</p>
<table class="table" title="NameNode Journals"> <table class="table" title="NameNode Journals">
<thead> <thead>
@ -152,13 +163,8 @@
{/nn.NameJournalStatus} {/nn.NameJournalStatus}
</tbody> </tbody>
</table> </table>
</div>
</div>
<hr/> <div class="page-header"><h1>NameNode Storage</h1></div>
<div class="panel panel-success">
<div class="panel-heading">NameNode Storage</div>
<div class="panel-body">
<table class="table" title="NameNode Storage"> <table class="table" title="NameNode Storage">
<thead><tr><td><b>Storage Directory</b></td><td><b>Type</b></td><td><b>State</b></td></tr></thead> <thead><tr><td><b>Storage Directory</b></td><td><b>Type</b></td><td><b>State</b></td></tr></thead>
{#nn.NameDirStatuses} {#nn.NameDirStatuses}
@ -166,70 +172,18 @@
{#failed}{#helper_dir_status type="Failed"/}{/failed} {#failed}{#helper_dir_status type="Failed"/}{/failed}
{/nn.NameDirStatuses} {/nn.NameDirStatuses}
</table> </table>
</div> </script>
</div>
<hr/>
<div class="panel panel-success"> <script type="text/x-dust-template" id="tmpl-snapshot">
<div class="panel-heading">Snapshot Summary</div> <div class="page-header"><h1>Snapshot Summary</h1></div>
<div class="panel-body"> <p><b>Snapshottable directories</b>: {SnapshottableDirectories}</p>
{#fs.SnapshotStats} <p><b>Snapshotted directories</b>: {Snapshots}</p>
<table class="table" title="Snapshot Summary"> </script>
<thead><tr><td><b>Snapshottable directories</b></td>
<td><b>Snapshotted directories</b></td></tr>
</thead>
<tbody>
<tr>
<td>{SnapshottableDirectories}</td>
<td>{Snapshots}</td>
</tr>
</tbody>
</table>
{/fs.SnapshotStats}
</div>
</div>
<hr/>
{#startup} <script type="text/x-dust-template" id="tmpl-datanode">
<div class="panel panel-success"> <div class="page-header"><h1>Datanode Information</h1></div>
<div class="panel-heading">Startup Progress</div> <div class="page-header"><h1><small>In operation</small></h1></div>
<div class="panel-body"> <small>
<p>Elapsed Time: {elapsedTime|fmt_time}, Percent Complete: {percentComplete|fmt_percentage}</p>
<table class="table">
<thead>
<tr>
<th>Phase</th>
<th>Completion</th>
<th>Elapsed Time</th>
</tr>
</thead>
<tbody>
{#phases}
<tr class="phase">
<td class="startupdesc">{desc} {file} {size|fmt_bytes}</td>
<td>{percentComplete|fmt_percentage}</td>
<td>{elapsedTime|fmt_time}</td>
</tr>
{#steps root_file=file}
<tr class="step">
<td class="startupdesc">{stepDesc} {stepFile} {stepSize|fmt_bytes} ({count}/{total})</td>
<td>{percentComplete|fmt_percentage}</td>
<td></td>
</tr>
{/steps}
{/phases}
</table>
</div>
</div>
{/startup}
<hr/>
<div class="panel panel-success">
<div class="panel-heading">Datanode Information</div>
<div class="panel-body">
<div class="panel panel-default" id="nodelist-operation">
<div class="panel-heading">Nodes in operation</div>
<div class="panel-body">
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
@ -243,9 +197,10 @@
<th>Blocks</th> <th>Blocks</th>
<th>Block pool used</th> <th>Block pool used</th>
<th>Failed Volumes</th> <th>Failed Volumes</th>
<th>Version</th>
</tr> </tr>
</thead> </thead>
{#nn.LiveNodes} {#LiveNodes}
<tr> <tr>
<td>{name} ({xferaddr})</td> <td>{name} ({xferaddr})</td>
<td>{lastContact}</td> <td>{lastContact}</td>
@ -257,9 +212,10 @@
<td>{numBlocks}</td> <td>{numBlocks}</td>
<td>{blockPoolUsed|fmt_bytes} ({blockPoolUsedPercent|fmt_percentage})</td> <td>{blockPoolUsed|fmt_bytes} ({blockPoolUsedPercent|fmt_percentage})</td>
<td>{volfails}</td> <td>{volfails}</td>
<td>{version}</td>
</tr> </tr>
{/nn.LiveNodes} {/LiveNodes}
{#nn.DeadNodes} {#DeadNodes}
<tr class="danger"> <tr class="danger">
<td>{name} ({xferaddr})</td> <td>{name} ({xferaddr})</td>
<td>{lastContact}</td> <td>{lastContact}</td>
@ -271,14 +227,14 @@
<td>-</td> <td>-</td>
<td>-</td> <td>-</td>
<td>-</td> <td>-</td>
<td>-</td>
</tr> </tr>
{/nn.DeadNodes} {/DeadNodes}
</table> </table>
</div> </small>
</div>
<div class="panel panel-default" id="nodelist-decom"> <div class="page-header"><h1><small>Decomissioning</small></h1></div>
<div class="panel-heading">Nodes being decomissioned</div> <small>
<div class="panel-body">
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
@ -289,7 +245,7 @@
<th>Under Replicated Blocks <br/>In files under construction</th> <th>Under Replicated Blocks <br/>In files under construction</th>
</tr> </tr>
</thead> </thead>
{#nn.DecomNodes} {#DecomNodes}
<tr> <tr>
<td>{name} ({xferaddr})</td> <td>{name} ({xferaddr})</td>
<td>{lastContact}</td> <td>{lastContact}</td>
@ -297,12 +253,39 @@
<td>{decommissionOnlyReplicas}</td> <td>{decommissionOnlyReplicas}</td>
<td>{underReplicateInOpenFiles}</td> <td>{underReplicateInOpenFiles}</td>
</tr> </tr>
{/nn.DecomNodes} {/DecomNodes}
</table>
</small>
</script>
<script type="text/x-dust-template" id="tmpl-startup-progress">
<div class="page-header"><h1>Startup Progress</h1></div>
<p>Elapsed Time: {elapsedTime|fmt_time}, Percent Complete: {percentComplete|fmt_percentage}</p>
<table class="table">
<thead>
<tr class="active">
<th>Phase</th>
<th style="text-align:center">Completion</th>
<th style="text-align:center">Elapsed Time</th>
</tr>
</thead>
<tbody>
{#phases}
<tr class="phase">
<td class="startupdesc">{desc} {file} {size|fmt_bytes}</td>
<td style="text-align:center">{percentComplete|fmt_percentage}</td>
<td style="text-align:center">{elapsedTime|fmt_time}</td>
</tr>
{#steps root_file=file}
<tr class="step">
<td class="startupdesc">{stepDesc} {stepFile} {stepSize|fmt_bytes} ({count}/{total})</td>
<td style="text-align:center">{percentComplete|fmt_percentage}</td>
<td></td>
</tr>
{/steps}
{/phases}
</tbody>
</table> </table>
</div>
</div>
</div>
</div>
</script> </script>
<script type="text/javascript" src="/static/jquery-1.10.2.min.js"> <script type="text/javascript" src="/static/jquery-1.10.2.min.js">

View File

@ -18,10 +18,20 @@
(function () { (function () {
"use strict"; "use strict";
var data = {}; dust.loadSource(dust.compile($('#tmpl-dfshealth').html(), 'dfshealth'));
dust.loadSource(dust.compile($('#tmpl-startup-progress').html(), 'startup-progress'));
dust.loadSource(dust.compile($('#tmpl-datanode').html(), 'datanode-info'));
dust.loadSource(dust.compile($('#tmpl-snapshot').html(), 'snapshot-info'));
function render() { function load_overview() {
var helpers = { var BEANS = [
{"name": "nn", "url": "/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo"},
{"name": "nnstat", "url": "/jmx?qry=Hadoop:service=NameNode,name=NameNodeStatus"},
{"name": "fs", "url": "/jmx?qry=Hadoop:service=NameNode,name=FSNamesystemState"},
{"name": "mem", "url": "/jmx?qry=java.lang:type=Memory"},
];
var HELPERS = {
'helper_fs_max_objects': function (chunk, ctx, bodies, params) { 'helper_fs_max_objects': function (chunk, ctx, bodies, params) {
var o = ctx.current(); var o = ctx.current();
if (o.MaxObjects > 0) { if (o.MaxObjects > 0) {
@ -37,35 +47,53 @@
} }
}; };
var base = dust.makeBase(helpers); var data = {};
dust.loadSource(dust.compile($('#tmpl-dfshealth').html(), 'dfshealth'));
dust.render('dfshealth', base.push(data), function(err, out) {
$('#panel').html(out);
});
}
var BEANS = [
{"name": "nn", "url": "/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo"},
{"name": "nnstat", "url": "/jmx?qry=Hadoop:service=NameNode,name=NameNodeStatus"},
{"name": "fs", "url": "/jmx?qry=Hadoop:service=NameNode,name=FSNamesystemState"},
{"name": "mem", "url": "/jmx?qry=java.lang:type=Memory"},
{"name": "startup", "url": "/startupProgress"}
];
// Workarounds for the fact that JMXJsonServlet returns non-standard JSON strings // Workarounds for the fact that JMXJsonServlet returns non-standard JSON strings
function data_workaround(d) { function data_workaround(d) {
function node_map_to_array(nodes) { d.nn.JournalTransactionInfo = JSON.parse(d.nn.JournalTransactionInfo);
var res = []; d.nn.NameJournalStatus = JSON.parse(d.nn.NameJournalStatus);
for (var n in nodes) { d.nn.NameDirStatuses = JSON.parse(d.nn.NameDirStatuses);
var p = nodes[n]; d.nn.NodeUsage = JSON.parse(d.nn.NodeUsage);
p.name = n; d.nn.CorruptFiles = JSON.parse(d.nn.CorruptFiles);
res.push(p); return d;
}
return res;
} }
function startup_progress_workaround(r) { load_json(
BEANS,
function(d) {
for (var k in d) {
data[k] = d[k].beans[0];
}
data = data_workaround(data);
render();
},
function (url, jqxhr, text, err) {
show_err_msg('<p>Failed to retrieve data from ' + url + ', cause: ' + err + '</p>');
});
function render() {
var base = dust.makeBase(HELPERS);
dust.render('dfshealth', base.push(data), function(err, out) {
$('#tab-overview').html(out);
$('a[href="#tab-datanode"]').click(load_datanode_info);
$('#ui-tabs a[href="#tab-overview"]').tab('show');
});
}
}
$('#ui-tabs a[href="#tab-overview"]').click(load_overview);
function show_err_msg(msg) {
$('#alert-panel-body').html(msg);
$('#alert-panel').show();
}
function ajax_error_handler(url, jqxhr, text, err) {
show_err_msg('<p>Failed to retrieve data from ' + url + ', cause: ' + err + '</p>');
}
function load_startup_progress() {
function workaround(r) {
function rename_property(o, s, d) { function rename_property(o, s, d) {
if (o[s] !== undefined) { if (o[s] !== undefined) {
o[d] = o[s]; o[d] = o[s];
@ -86,36 +114,66 @@
}); });
return r; return r;
} }
$.get('/startupProgress', function (resp) {
d.nn.JournalTransactionInfo = JSON.parse(d.nn.JournalTransactionInfo); var data = workaround(resp);
d.nn.NameJournalStatus = JSON.parse(d.nn.NameJournalStatus); dust.render('startup-progress', data, function(err, out) {
d.nn.NameDirStatuses = JSON.parse(d.nn.NameDirStatuses); $('#tab-startup-progress').html(out);
d.nn.NodeUsage = JSON.parse(d.nn.NodeUsage); $('#ui-tabs a[href="#tab-startup-progress"]').tab('show');
d.nn.LiveNodes = node_map_to_array(JSON.parse(d.nn.LiveNodes));
d.nn.DeadNodes = node_map_to_array(JSON.parse(d.nn.DeadNodes));
d.nn.DecomNodes = node_map_to_array(JSON.parse(d.nn.DecomNodes));
d.nn.CorruptFiles = JSON.parse(d.nn.CorruptFiles);
d.fs.SnapshotStats = JSON.parse(d.fs.SnapshotStats);
d.startup = startup_progress_workaround(d.startup);
return d;
}
function show_err_msg(msg) {
$('#alert-panel-body').html(msg);
$('#alert-panel').show();
}
load_json(
BEANS,
function(d) {
for (var k in d) {
data[k] = k === "startup" ? d[k] : d[k].beans[0];
}
data = data_workaround(data);
render();
},
function (url, jqxhr, text, err) {
show_err_msg('<p>Failed to retrieve data from ' + url + ', cause: ' + err + '</p>');
}); });
}).error(ajax_error_handler);
}
$('#ui-tabs a[href="#tab-startup-progress"]').click(load_startup_progress);
function load_datanode_info() {
function workaround(r) {
function node_map_to_array(nodes) {
var res = [];
for (var n in nodes) {
var p = nodes[n];
p.name = n;
res.push(p);
}
return res;
}
r.LiveNodes = node_map_to_array(JSON.parse(r.LiveNodes));
r.DeadNodes = node_map_to_array(JSON.parse(r.DeadNodes));
r.DecomNodes = node_map_to_array(JSON.parse(r.DecomNodes));
return r;
}
$.get('/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo', function (resp) {
var data = workaround(resp.beans[0]);
dust.render('datanode-info', data, function(err, out) {
$('#tab-datanode').html(out);
$('#ui-tabs a[href="#tab-datanode"]').tab('show');
});
}).error(ajax_error_handler);
}
$('a[href="#tab-datanode"]').click(load_datanode_info);
function load_snapshot_info() {
$.get('/jmx?qry=Hadoop:service=NameNode,name=FSNamesystemState', function (resp) {
var data = JSON.parse(resp.beans[0].SnapshotStats);
dust.render('snapshot-info', data, function(err, out) {
$('#tab-snapshot').html(out);
$('#ui-tabs a[href="#tab-snapshot"]').tab('show');
});
}).error(ajax_error_handler);
}
$('#ui-tabs a[href="#tab-snapshot"]').click(load_snapshot_info);
var hash = window.location.hash;
if (hash === "#tab-datanode") {
load_datanode_info();
} else if (hash === "#tab-snapshot") {
load_snapshot_info();
} else if (hash === "#tab-startup-progress") {
load_startup_progress();
} else {
load_overview();
}
})(); })();

View File

@ -193,3 +193,23 @@ div.security {
color: #fff !important; color: #fff !important;
background-color: #5FA33E !important; background-color: #5FA33E !important;
} }
header.bs-docs-nav, header.bs-docs-nav .navbar-brand {
border-radius: 0px;
background-color: #5fa33e;
color: #fff;
}
#ui-tabs > li > a {
color: #dcf0d3;
}
#ui-tabs .active a {
color: #fff;
background-color: #446633;
}
#alert-panel {
margin-top:20px;
display: none;
}