Support Questions

Find answers, ask questions, and share your expertise

How to find active namenode from cli

avatar
Contributor

Hi Team,

 

How to find active name node from cli and also want to know where to check automatic namenode failover triggered in the cluster?

3 REPLIES 3

avatar
Expert Contributor

avatar
Contributor

Thanks to @vamsi_redd for helping us with Ambari API.

Do you have the same API for Cloudera Manager as well?

avatar
Expert Contributor

Hello @khanarshadazmat ,

 

You may get the role information using CM API for HDFS service.

 

API: 

https://archive.cloudera.com/cm7/7.2.4/generic/jar/cm_api/apidocs/resource_RolesResource.html#resour...

 

See the below example for a better understanding:

• When I execute the above API, I would get the below details for HDFS service:

 "name" : "HDFS-1-NAMENODE-cb7144bc695976e34cfbaaf26c176d21",
    "type" : "NAMENODE",
    "serviceRef" : {
      "clusterName" : "Cluster 1",
      "serviceName" : "HDFS-1",
      "serviceDisplayName" : "HDFS-1",
      "serviceType" : "HDFS"
    },
... "roleState" : "STARTED", "healthSummary" : "GOOD", "configStalenessStatus" : "FRESH", "haStatus" : "STANDBY", "maintenanceMode" : false, "commissionState" : "COMMISSIONED", "roleConfigGroupRef" : { "roleConfigGroupName" : "HDFS-1-NAMENODE-BASE" },

• and, for the second namenode, I'll get something as below:

"name" : "HDFS-1-NAMENODE-b1d777dd6714507397225b07ea9057ce",
    "type" : "NAMENODE",
    "serviceRef" : {
      "clusterName" : "Cluster 1",
      "serviceName" : "HDFS-1",
      "serviceDisplayName" : "HDFS-1",
      "serviceType" : "HDFS"
    },
...
"roleState" : "STARTED", "healthSummary" : "GOOD", "configStalenessStatus" : "FRESH", "haStatus" : "ACTIVE", "maintenanceMode" : false, "commissionState" : "COMMISSIONED", "roleConfigGroupRef" : { "roleConfigGroupName" : "HDFS-1-NAMENODE-BASE" }, "entityStatus" : "GOOD_HEALTH"

• In both the above examples, check for the keyword "haStatus". The namenode with haStatus as Active would be your Active Namenode. 

 

Let me know if this helps.

 

Cheers!

Was your question answered? Make sure to mark the answer as the accepted solution.

If you find a reply useful, say thanks by clicking on the thumbs up button.