Reply
rvt
New Contributor
Posts: 2
Registered: ‎03-13-2019

CM API to get hdfs active namenode

[ Edited ]

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

 

rvt
New Contributor
Posts: 2
Registered: ‎03-13-2019

Re: CM API to get hdfs active namenode

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

 

 

 

Cloudera Employee
Posts: 5
Registered: ‎01-11-2019

Re: CM API to get hdfs active namenode

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
Announcements