You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by wu...@apache.org on 2022/10/11 17:14:05 UTC

[ambari] branch trunk updated: AMBARI-25220 Provide an option to print Hadoop Topology (#3390)

This is an automated email from the ASF dual-hosted git repository.

wuzhiguo pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 4d3d3bd342 AMBARI-25220 Provide an option to print Hadoop Topology (#3390)
4d3d3bd342 is described below

commit 4d3d3bd3426dd1809bad9609b64b57242b7a24d0
Author: Viraj Jasani <vj...@apache.org>
AuthorDate: Tue Oct 11 10:13:56 2022 -0700

    AMBARI-25220 Provide an option to print Hadoop Topology (#3390)
---
 .../resources/stacks/BIGTOP/3.2.0/services/HDFS/metainfo.xml     | 7 +++++++
 .../BIGTOP/3.2.0/services/HDFS/package/scripts/namenode.py       | 9 +++++++++
 2 files changed, 16 insertions(+)

diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HDFS/metainfo.xml
index 9782003985..bb526778e2 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HDFS/metainfo.xml
@@ -121,6 +121,13 @@
                 <scriptType>PYTHON</scriptType>
               </commandScript>
             </customCommand>
+            <customCommand>
+              <name>PRINT_TOPOLOGY</name>
+              <commandScript>
+                <script>scripts/namenode.py</script>
+                <scriptType>PYTHON</scriptType>
+              </commandScript>
+            </customCommand>
           </customCommands>
         </component>
 
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HDFS/package/scripts/namenode.py b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HDFS/package/scripts/namenode.py
index 33734df5e2..28f854b4cf 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HDFS/package/scripts/namenode.py
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HDFS/package/scripts/namenode.py
@@ -170,6 +170,15 @@ class NameNode(Script):
     namenode(action="decommission", hdfs_binary=hdfs_binary)
     self.configure(env)
 
+  def print_topology(self, env):
+    import params
+    env.set_params(params)
+    Execute("hdfs dfsadmin -printTopology",
+            user=params.hdfs_user,
+            path=[params.hadoop_bin_dir],
+            logoutput=True
+            )
+
 
 @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
 class NameNodeDefault(NameNode):


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ambari.apache.org
For additional commands, e-mail: commits-help@ambari.apache.org