- 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 check the namenode status?
- Labels:
-
Apache Hadoop
Created 05-16-2016 09:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As a developer how can I check the current state of a given Namenode? I have tried the getServiceState command but that is only intended for the admins with superuser access. Any command that can be run from the edge node to get the status of a provided namemnode??
Created 05-17-2016 02:09 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Finally, I got an answer to this.
As a developer, one cannot execute dfsadmin commands due to the restriction in the policy. To check the namenode availability I used the below if loop in shellscript which did the trick. It wont tell you exactly the namenode is active but with the loop you can easily execute the program accordingly.
if hdfs dfs -test -e hdfs://namenodeip/* ; then echo exist else echo not exist fi
Created 05-16-2016 12:05 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can run the command
hdfs dfsadmin -report
However you may not able to see full output but still can see something like below
Configured Capacity: 28956426240 (26.97 GB)Present Capacity: 9947332608 (9.26 GB)DFS Remaining: 7329509376 (6.83 GB)DFS Used: 2617823232 (2.44 GB)DFS Used%: 26.32%Under replicated blocks: 0Blocks with corrupt replicas: 0Missing blocks: 0Missing blocks (with replication factor 1): 0
Created 05-16-2016 01:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created 05-17-2016 02:09 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Finally, I got an answer to this.
As a developer, one cannot execute dfsadmin commands due to the restriction in the policy. To check the namenode availability I used the below if loop in shellscript which did the trick. It wont tell you exactly the namenode is active but with the loop you can easily execute the program accordingly.
if hdfs dfs -test -e hdfs://namenodeip/* ; then echo exist else echo not exist fi
Created 11-07-2017 06:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can do a curl command to find out the Active and secondary Namenode for example
curl -u username -H "X-Requested-By: ambari" -X GET http://cluster-hostname:8080/api/v1/clusters//services/HDFS
Created 11-07-2017 06:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can find it from boht way
thorugh Hadoop commands and Curl command
1) hdfs dfsamdin -report
2) Hadoop fsck /
3) curl -u username -H "X-Requested-By: ambari" -X GET http://cluster-hostname:8080/api/v1/clusters/clustername/services/HDFS
