Hello @Masood, I believe you are asking the commands to run in order to determine the active NN apart from CM UI ( CM > HDFS > Instance > NameNode)
From CLI you have to run couple of commands to detemrine the Active/Standby NN
List the namenode hostnames
# hdfs getconf -namenodes
c2301-node2.coelab.cloudera.com c2301-node3.coelab.cloudera.com
Get nameservice name
# hdfs getconf -confKey dfs.nameservices
nameservice1
Get active and standby namenodes
# hdfs getconf -confKey dfs.ha.namenodes.nameservice1
namenode11,namenode20
# su - hdfs
$ hdfs haadmin -getServiceState namenode11
active
$ hdfs haadmin -getServiceState namenode20
standby
Get active and standby namenode hostnames
$ hdfs getconf -confKey dfs.namenode.rpc-address.nameservice1.namenode11
c2301-node2.coelab.cloudera.com:8020
$ hdfs getconf -confKey dfs.namenode.rpc-address.nameservice1.namenode20
c2301-node3.coelab.cloudera.com:8020
If you want to get the active namenode hostname from hdfs-site.xml file, you can go through following python script in github – https://github.com/grakala/getActiveNN.
Thank you