Created
June 27, 2014 20:06
-
-
Save zcox/38072d0e3d66f779e552 to your computer and use it in GitHub Desktop.
jank shell script to extract dynamic hbase master port from zookeeper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
hostname=`hostname` | |
regex="${hostname}${hostname},([0-9]+)," | |
out=`/usr/lib/zookeeper/bin/zkCli.sh <<EOF | |
get /hbase/master | |
quit | |
EOF` | |
[[ $out =~ $regex ]] | |
port="${BASH_REMATCH[1]}" | |
echo "HBase master port = $port" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment