bin/hbase | 6 ++++-- bin/hbase-cleanup.sh | 14 ++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/bin/hbase b/bin/hbase index 8db26f1..c90a73b 100755 --- a/bin/hbase +++ b/bin/hbase @@ -564,16 +564,18 @@ elif [ "$COMMAND" = "zookeeper" ] ; then fi elif [ "$COMMAND" = "clean" ] ; then case $1 in - --cleanZk|--cleanHdfs|--cleanAll) + --cleanZk|--cleanHdfs|--cleanAll|--cleanAcls|--cleanHwalDir) matches="yes" ;; *) ;; esac if [ $# -ne 1 -o "$matches" = "" ]; then - echo "Usage: hbase clean (--cleanZk|--cleanHdfs|--cleanAll)" + echo "Usage: hbase clean (--cleanZk|--cleanHdfs|--cleanAll|--cleanAcls|--cleanHwalDir)" echo "Options: " echo " --cleanZk cleans hbase related data from zookeeper." echo " --cleanHdfs cleans hbase related data from hdfs." echo " --cleanAll cleans hbase related data from both zookeeper and hdfs." + echo " --cleanAcls cleans hbase acl related data in zookeeper." + echo " --cleanHwalDir cleans hbase wal directroy if it specifies explicitly." exit 1; fi "$bin"/hbase-cleanup.sh --config ${HBASE_CONF_DIR} $@ diff --git a/bin/hbase-cleanup.sh b/bin/hbase-cleanup.sh index 3a764df..85adcb1 100755 --- a/bin/hbase-cleanup.sh +++ b/bin/hbase-cleanup.sh @@ -31,7 +31,7 @@ # HBASE_SSH_OPTS Options passed to ssh when running remote commands. # -usage="Usage: hbase-cleanup.sh (--cleanZk|--cleanHdfs|--cleanAll|--cleanAcls)" +usage="Usage: hbase-cleanup.sh (--cleanZk|--cleanHdfs|--cleanAll|--cleanAcls|--cleanHwalDir)" bin=`dirname "$0"` bin=`cd "$bin">/dev/null; pwd` @@ -40,7 +40,7 @@ bin=`cd "$bin">/dev/null; pwd` . "$bin"/hbase-config.sh case $1 in - --cleanZk|--cleanHdfs|--cleanAll|--cleanAcls) + --cleanZk|--cleanHdfs|--cleanAll|--cleanAcls|--cleanHwalDir) matches="yes" ;; *) ;; esac @@ -57,6 +57,8 @@ if [ "$zparent" == "null" ]; then zparent="/hbase"; fi hrootdir=`$bin/hbase org.apache.hadoop.hbase.util.HBaseConfTool hbase.rootdir` if [ "$hrootdir" == "null" ]; then hrootdir="file:///tmp/hbase-${USER}/hbase"; fi +hwaldir=`$bin/hbase org.apache.hadoop.hbase.util.HBaseConfTool hbase.wal.dir` + check_for_znodes() { command=$1; case $command in @@ -98,14 +100,18 @@ execute_clean_acls() { clean_up() { case $1 in --cleanZk) - execute_zk_command "rmr ${zparent}"; + execute_zk_command "deleteall ${zparent}"; ;; --cleanHdfs) execute_hdfs_command "-rm -R ${hrootdir}" ;; + --cleanHwalDir) + if [ "$hwaldir" != "null" ]; then execute_hdfs_command "-rm -R ${hwaldir}"; fi + ;; --cleanAll) - execute_zk_command "rmr ${zparent}"; + execute_zk_command "deleteall ${zparent}"; execute_hdfs_command "-rm -R ${hrootdir}" + if [ "$hwaldir" != "null" ]; then execute_hdfs_command "-rm -R ${hwaldir}"; fi ;; --cleanAcls) execute_clean_acls;