Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

CM API to get hdfs active namenode


CM API to get hdfs active namenode

New Contributor



Can you help determine the CM API to get active namenode in hdfs. I have below api details



I was not able to go any further than below

curl --insecure -u admin:<password> https://<cmhost>:7183/api/v19/clusters/<cluster name>/services/


Can you help please?


Many Thanks




Re: CM API to get hdfs active namenode

New Contributor

Closest I could find below. Do you have any better way to do this ?


curl --silent --insecure --user admin:<password> --request GET https://<CM Host>:7183/api/v19/clusters/< cluster name>/services/hdfs/roles/hdfs-NAMENODE-<1st namenode role id> |grep haStatus
"haStatus" : "STANDBY"


curl --silent --insecure --user admin:<password> --request GET https://<CM Host> :7183/api/v19/clusters/<cluster name>/services/hdfs/roles/hdfs-NAMENODE-<second NN role id> |grep haStatus
"haStatus" : "ACTIVE",




Re: CM API to get hdfs active namenode

Cloudera Employee
Hi rvt,

Yes, you can get the status of the namenode using the below-mentioned way:

http://<cmhost>:<port>/api/v1/clusters/<cluster-name>/services/HDFS/roles/HDFS-NAMENODE-<namenode id>

and search for "haStatus"

Tarun Jangid
Don't have an account?
Coming from Hortonworks? Activate your account here