Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.24 KB | None | 0 0
  1. #! /usr/bin/bash
  2.  
  3. NODE="$(hdfs fsck -blockId $1 | grep -i "^Block replica" | head -n 1 | awk '{print substr($5,0,index($5,"/") - 1);}')"
  4. LOCATION="$(sudo -u hdfsuser ssh hdfsuser@$NODE "locate $1 && exit" | head -n 1)"
  5. echo $NODE:$LOCATION
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement