Support Questions
Find answers, ask questions, and share your expertise
Announcements
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

Hi,

 

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

 

http://cloudera.github.io/cm_api/apidocs/v19/ns0_apiNameservice.html
http://cloudera.github.io/cm_api/apidocs/v19/path__clusters_-clusterName-_services_-serviceName-_rol...

 

 

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

rvt

 

2 REPLIES 2

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"

Regards,
Tarun Jangid