hadoop - How do I read a block from a specific replica in HDFS? -


i need write program pulling out blocks in hdfs from specific data node given file. not run within mapreduce job, pro grammatically gathering statistics on cluster.

so far, given file, have been able extract block locations associated file. each block there multiple replicas , need access blocks lying on replica. understand these remote read operations.

i have done following:

configuration conf = new configuration(); filesystem fs = filesystem.get(conf); path infile = new path(args[0]); filestatus status = fs.getfilestatus(infile); blocklocation[] locs = fs.getfileblocklocations(status, 0, status.getlen()); string[] hosts = locs[0].gethosts (); 

could tell me how can fetch block pointed locs[0] hosts[0]?


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -