Created 11-03-2020 05:53 AM
How to identify which NameNode is Active. Is there any command or I can view it through the CDP.
Created 11-03-2020 03:34 PM
@Masood
You could use the CDP REST API
http://<cmhost>:<port>/api/v1/clusters/<cluster-name>/services/HDFS/roles/HDFS-NAMENODE-<namenode id>
And look out for and search for "haStatus"
Created 11-09-2020 09:42 AM
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