Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions hadoop-hdds/container-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,37 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
<excludeFilterFile>${basedir}/dev-support/findbugsExcludeFile.xml</excludeFilterFile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-common-html</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdds-server-framework</artifactId>
<outputDirectory>${project.build.outputDirectory}
</outputDirectory>
<includes>webapps/static/**/*.*</includes>
</artifactItem>
<artifactItem>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdds-docs</artifactId>
<outputDirectory>${project.build.outputDirectory}/webapps/hddsDatanode</outputDirectory>
<includes>docs/**/*.*</includes>
</artifactItem>
</artifactItems>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,16 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/

package org.apache.hadoop.ozone;

import org.apache.hadoop.hdds.annotation.InterfaceAudience;
import org.apache.hadoop.hdds.server.ServiceRuntimeInfo;

/**
* This is the JMX management interface for DN information.
*/
@InterfaceAudience.Private
public interface DNMXBean extends ServiceRuntimeInfo {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.hadoop.ozone;

import org.apache.hadoop.hdds.server.ServiceRuntimeInfoImpl;
import org.apache.hadoop.hdds.utils.VersionInfo;

/**
* This is the JMX management class for DN information.
*/
public class DNMXBeanImpl extends ServiceRuntimeInfoImpl implements DNMXBean {
public DNMXBeanImpl(
VersionInfo versionInfo) {
super(versionInfo);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
import java.security.KeyPair;
import java.security.cert.CertificateException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.ConcurrentHashMap;

import com.sun.jmx.mbeanserver.Introspector;
import org.apache.hadoop.conf.Configurable;
import org.apache.hadoop.hdds.DFSConfigKeysLegacy;
import org.apache.hadoop.hdds.HddsUtils;
Expand All @@ -49,6 +51,7 @@
import org.apache.hadoop.hdds.server.http.RatisDropwizardExports;
import org.apache.hadoop.hdds.tracing.TracingUtil;
import org.apache.hadoop.hdds.utils.HddsVersionInfo;
import org.apache.hadoop.metrics2.util.MBeans;
import org.apache.hadoop.ozone.container.common.helpers.ContainerUtils;
import org.apache.hadoop.ozone.container.common.statemachine.DatanodeStateMachine;
import org.apache.hadoop.ozone.container.common.utils.HddsVolumeUtil;
Expand All @@ -70,6 +73,8 @@
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Command;

import javax.management.ObjectName;

/**
* Datanode service plugin to start the HDDS container services.
*/
Expand All @@ -95,6 +100,10 @@ public class HddsDatanodeService extends GenericCli implements ServicePlugin {
private volatile AtomicBoolean isStopped = new AtomicBoolean(false);
private final Map<String, RatisDropwizardExports> ratisMetricsMap =
new ConcurrentHashMap<>();
private DNMXBeanImpl serviceRuntimeInfo =
new DNMXBeanImpl(HddsVersionInfo.HDDS_VERSION_INFO) {};
private ObjectName dnInfoBeanName;

//Constructor for DataNode PluginService
public HddsDatanodeService(){}

Expand Down Expand Up @@ -132,6 +141,7 @@ private static HddsDatanodeService createHddsDatanodeService(

public static void main(String[] args) {
try {
Introspector.checkCompliance(DNMXBeanImpl.class);
HddsDatanodeService hddsDatanodeService =
createHddsDatanodeService(args, true);
hddsDatanodeService.run(args);
Expand Down Expand Up @@ -180,6 +190,8 @@ public void start(OzoneConfiguration configuration) {
}

public void start() {
serviceRuntimeInfo.setStartTime();

RatisDropwizardExports.
registerRatisMetricReporters(ratisMetricsMap);

Expand Down Expand Up @@ -245,7 +257,7 @@ public void start() {
.equalsIgnoreCase(System.getenv("OZONE_DATANODE_STANDALONE_TEST"))) {
startRatisForTest();
}

registerMXBean();
} catch (IOException e) {
throw new RuntimeException("Can't start the HDDS datanode plugin", e);
} catch (AuthenticationException ex) {
Expand Down Expand Up @@ -345,6 +357,21 @@ private void getSCMSignedCert(OzoneConfiguration config) {
}
}

private void registerMXBean() {
Map<String, String> jmxProperties = new HashMap<>();
jmxProperties.put("component", "ServerRuntime");
this.dnInfoBeanName = HddsUtils.registerWithJmxProperties(
"HddsDatanodeService",
"HddsDatanodeServiceInfo", jmxProperties, this.serviceRuntimeInfo);
}

private void unregisterMXBean() {
if (this.dnInfoBeanName != null) {
MBeans.unregister(this.dnInfoBeanName);
this.dnInfoBeanName = null;
}
}

/**
* Creates CSR for DN.
* @param config
Expand Down Expand Up @@ -512,6 +539,7 @@ public void stop() {
LOG.error("Stopping HttpServer is failed.", e);
}
}
unregisterMXBean();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<table class="table table-bordered table-striped" class="col-md-6">
<tbody>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function () {
"use strict";
angular.module('dn', ['ozone', 'nvd3']);

angular.module('dn').component('dnOverview', {
templateUrl: 'dn-overview.html',
require: {
overview: "^overview"
},
controller: function ($http) {
var ctrl = this;
$http.get("jmx?qry=Hadoop:service=HddsDatanode,name=StorageContainerMetrics")
.then(function (result) {
ctrl.dnmetrics = result.data.beans[0];
});
}
});
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="HDFS Storage Container Manager">

<title>HDDS Datanode Service</title>

<link href="static/bootstrap-3.4.1/css/bootstrap.min.css" rel="stylesheet">
<link href="static/hadoop.css" rel="stylesheet">
<link href="static/nvd3-1.8.5.min.css" rel="stylesheet">

<link href="static/ozone.css" rel="stylesheet">

</head>

<body ng-app="dn">

<header class="navbar navbar-inverse navbar-fixed-top bs-docs-nav">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">HDDS Datanode Service</a>
</div>


<navmenu
metrics="{ 'Rpc metrics' : '#!/metrics/rpc'}"></navmenu>


</div>
</header>

<div class="container-fluid" style="margin: 12pt">

<ng-view></ng-view>

</div><!-- /.container -->

<script src="static/jquery-3.5.1.min.js"></script>
<script src="static/angular-1.7.9.min.js"></script>
<script src="static/angular-route-1.7.9.min.js"></script>
<script src="static/d3-3.5.17.min.js"></script>
<script src="static/nvd3-1.8.5.min.js"></script>
<script src="static/angular-nvd3-1.0.9.min.js"></script>
<script src="static/ozone.js"></script>
<script src="dn.js"></script>
<script src="static/bootstrap-3.4.1/js/bootstrap.min.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<overview>
<dn-overview>
</dn-overview>
</overview>