Skip to content

Instantly share code, notes, and snippets.

@ashwanthkumar
Last active September 25, 2015 02:32
Show Gist options
  • Save ashwanthkumar/3624a4e69ab26236a746 to your computer and use it in GitHub Desktop.
Save ashwanthkumar/3624a4e69ab26236a746 to your computer and use it in GitHub Desktop.
Useful to find the missing host, when you've 100s of machines on AWS running TT and DN process and their dns names are autogenerated
# This assumes that jq is installed on your machine
JT_MACHINE="jt-host"
NN_MACHINE="nn-host"
# Get all the TTs
curl "http://${JT_MACHINE}:50030/jmx?qry=hadoop:service=JobTracker,name=JobTrackerInfo" | jq -r .beans[].AliveNodesInfoJson | jq -r .[].hostname | sort > tasktrackers
# Get all the DNs
curl "http://${NN_MACHINE}:50070/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo" | jq -r .beans[].LiveNodes | jq -r 'keys | .[]' | sort > datanodes
diff tasktrackers datanodes | egrep "<|>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment