HBASE-4244 Refactor bin/hbase help

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1160890 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nicolas Spiegelberg 2011-08-23 21:37:32 +00:00
parent f5105f5085
commit 2eec39fa48
3 changed files with 32 additions and 13 deletions

View File

@ -396,6 +396,7 @@ Release 0.91.0 - Unreleased
(Benoit Sigoure)
HBASE-4199 blockCache summary - backend (Doug Meil)
HBASE-4240 Allow Loadbalancer to be pluggable
HBASE-4244 Refactor bin/hbase help
TASKS
HBASE-3559 Move report of split to master OFF the heartbeat channel

View File

@ -65,20 +65,28 @@ fi
# if no args specified, show usage
if [ $# = 0 ]; then
echo "Usage: hbase <command>"
echo "where <command> is one of:"
echo "where <command> an option from one of these categories:"
echo ""
echo "DBA TOOLS"
echo " shell run the HBase shell"
echo " hbck run the hbase 'fsck' tool"
echo " hlog write-ahead-log analyzer"
echo " hfile store file analyzer"
echo " migrate upgrade an hbase.rootdir"
echo " zkcli run the ZooKeeper shell"
echo ""
echo "PROCESS MANAGEMENT"
echo " master run an HBase HMaster node"
echo " regionserver run an HBase HRegionServer node"
echo " zookeeper run a Zookeeper server"
echo " rest run an HBase REST server"
echo " thrift run an HBase Thrift server"
echo " avro run an HBase Avro server"
echo " migrate upgrade an hbase.rootdir"
echo " hbck run the hbase 'fsck' tool"
echo ""
echo "PACKAGE MANAGEMENT"
echo " classpath dump hbase CLASSPATH"
echo " version print the version"
echo ""
echo " or"
echo " CLASSNAME run the class named CLASSNAME"
echo "Most commands print help when invoked w/o parameters."
@ -243,6 +251,19 @@ unset IFS
# figure out which class to run
if [ "$COMMAND" = "shell" ] ; then
CLASS="org.jruby.Main ${HBASE_HOME}/bin/hirb.rb"
elif [ "$COMMAND" = "hbck" ] ; then
CLASS='org.apache.hadoop.hbase.util.HBaseFsck'
elif [ "$COMMAND" = "hlog" ] ; then
CLASS='org.apache.hadoop.hbase.regionserver.wal.HLogPrettyPrinter'
elif [ "$COMMAND" = "hfile" ] ; then
CLASS='org.apache.hadoop.hbase.io.hfile.HFile'
elif [ "$COMMAND" = "migrate" ] ; then
CLASS='org.apache.hadoop.hbase.util.Migrate'
elif [ "$COMMAND" = "zkcli" ] ; then
# ZooKeeperMainServerArg returns '-server HOST:PORT' or empty string.
SERVER_ARG=`"$bin"/hbase org.apache.hadoop.hbase.zookeeper.ZooKeeperMainServerArg`
CLASS="org.apache.zookeeper.ZooKeeperMain ${SERVER_ARG}"
elif [ "$COMMAND" = "master" ] ; then
CLASS='org.apache.hadoop.hbase.master.HMaster'
if [ "$1" != "stop" ] ; then
@ -268,19 +289,12 @@ elif [ "$COMMAND" = "avro" ] ; then
if [ "$1" != "stop" ] ; then
HBASE_OPTS="$HBASE_OPTS $HBASE_AVRO_OPTS"
fi
elif [ "$COMMAND" = "migrate" ] ; then
CLASS='org.apache.hadoop.hbase.util.Migrate'
elif [ "$COMMAND" = "hbck" ] ; then
CLASS='org.apache.hadoop.hbase.util.HBaseFsck'
elif [ "$COMMAND" = "zookeeper" ] ; then
CLASS='org.apache.hadoop.hbase.zookeeper.HQuorumPeer'
if [ "$1" != "stop" ] ; then
HBASE_OPTS="$HBASE_OPTS $HBASE_ZOOKEEPER_OPTS"
fi
elif [ "$COMMAND" = "zkcli" ] ; then
# ZooKeeperMainServerArg returns '-server HOST:PORT' or empty string.
SERVER_ARG=`"$bin"/hbase org.apache.hadoop.hbase.zookeeper.ZooKeeperMainServerArg`
CLASS="org.apache.zookeeper.ZooKeeperMain ${SERVER_ARG}"
elif [ "$COMMAND" = "classpath" ] ; then
echo $CLASSPATH
exit 0

View File

@ -298,6 +298,10 @@ public class HLogPrettyPrinter {
}
}
public static void main(String[] args) throws IOException {
run(args);
}
/**
* Pass one or more log file names and formatting options and it will dump out
* a text version of the contents on <code>stdout</code>.
@ -329,7 +333,7 @@ public class HLogPrettyPrinter {
files = cmd.getArgList();
if (files.size() == 0 || cmd.hasOption("h")) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("HFile filename(s) ", options, true);
formatter.printHelp("HLog <filename...>", options, true);
System.exit(-1);
}
// configure the pretty printer using command line options