Support Questions
Find answers, ask questions, and share your expertise

How to See which NameNode is Active?

Explorer

How to identify which NameNode is Active. Is there any command or I can view it through the CDP.

2 REPLIES 2

Mentor

@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" 

Rising Star

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 

; ;