How to get all slave nodes running in Hadoop cluster and resource available on it using Java Code -


i searching way find slave nodes available in hadoop cluster not succeeded. tried is, wrote java code read slaves file present below path

*$hadoop_home/etc/hadoop/slaves* (am using hadoop-2.2.0), 

using simple java code:

bufferedreader br = null;          try {              string slavenode="";              br = new bufferedreader(new filereader("/usr/local/hadoop/etc/hadoop/slaves"));              while ((slavenode = br.readline()) != null) {                 system.out.println(slavenode);             }          } catch (ioexception e) {             e.printstacktrace();         } {             try {                 if (br != null)br.close();             } catch (ioexception ex) {                 ex.printstacktrace();             }         } 

but need method can slave nodes present , resource available on it.please me here..


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -