Skip to content

Instantly share code, notes, and snippets.

@zcox
Created June 27, 2014 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zcox/38072d0e3d66f779e552 to your computer and use it in GitHub Desktop.
Save zcox/38072d0e3d66f779e552 to your computer and use it in GitHub Desktop.
jank shell script to extract dynamic hbase master port from zookeeper
#!/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