- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to find active namenode from cli
- Labels:
-
HDFS
Created ‎05-30-2021 04:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Created ‎05-30-2021 06:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can use the below ambari api to get the Active NN:
http://{HOST}:8080/api/v1/clusters/{CLUSTER_NAME}/host_components?HostRoles/component_name=NAMENODE&...
Created ‎05-30-2021 11:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks to @vamsi_redd for helping us with Ambari API.
Do you have the same API for Cloudera Manager as well?
Created on ‎05-31-2021 12:42 AM - edited ‎05-31-2021 12:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @khanarshadazmat ,
You may get the role information using CM API for HDFS service.
API:
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.
