hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject [1/5] hbase git commit: HBASE-15508 Add command for exporting snapshot in hbase command script (Yufeng Jiang)
Date Wed, 23 Mar 2016 17:49:57 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 b697f53be -> 47eb79311
  refs/heads/branch-1.1 f3251dab4 -> 7032c0cb7
  refs/heads/branch-1.2 e60f93de7 -> 9725a5bd7
  refs/heads/branch-1.3 a8bd8eb92 -> fc966c840
  refs/heads/master cadfb21f4 -> 7177e4be6


HBASE-15508 Add command for exporting snapshot in hbase command script (Yufeng Jiang)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7177e4be
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7177e4be
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7177e4be

Branch: refs/heads/master
Commit: 7177e4be64d134144ddc64b8635b06c7d3141f0c
Parents: cadfb21
Author: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Authored: Wed Mar 23 10:26:32 2016 -0700
Committer: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Committed: Wed Mar 23 10:26:32 2016 -0700

----------------------------------------------------------------------
 bin/hbase                                       | 35 +++++++++++++++-----
 .../hadoop/hbase/snapshot/ExportSnapshot.java   |  4 +--
 .../hadoop/hbase/snapshot/SnapshotInfo.java     |  4 +--
 3 files changed, 30 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7177e4be/bin/hbase
----------------------------------------------------------------------
diff --git a/bin/hbase b/bin/hbase
index 7faaa26..be519ac 100755
--- a/bin/hbase
+++ b/bin/hbase
@@ -71,20 +71,22 @@ if [ -d "${HBASE_HOME}/target" ]; then
   in_dev_env=true
 fi
 
+read -d '' options_string << EOF
+Options:
+  --config DIR     Configuration direction to use. Default: ./conf
+  --hosts HOSTS    Override the list in 'regionservers' file
+  --auth-as-server Authenticate to ZooKeeper using servers configuration
+EOF
 # if no args specified, show usage
 if [ $# = 0 ]; then
   echo "Usage: hbase [<options>] <command> [<args>]"
-  echo "Options:"
-  echo "  --config DIR    Configuration direction to use. Default: ./conf"
-  echo "  --hosts HOSTS   Override the list in 'regionservers' file"
-  echo "  --auth-as-server Authenticate to ZooKeeper using servers configuration"
+  echo "$options_string"
   echo ""
   echo "Commands:"
   echo "Some commands take arguments. Pass no args or -h for usage."
   echo "  shell           Run the HBase shell"
   echo "  hbck            Run the hbase 'fsck' tool"
-  echo "  snapshot        Create a new snapshot of a table"
-  echo "  snapshotinfo    Tool for dumping snapshot information"
+  echo "  snapshot        Tool for managing snapshots"
   echo "  wal             Write-ahead-log analyzer"
   echo "  hfile           Store file analyzer"
   echo "  zkcli           Run the ZooKeeper shell"
@@ -318,9 +320,24 @@ elif [ "$COMMAND" = "upgrade" ] ; then
   echo "Please follow the documentation at http://hbase.apache.org/book.html#upgrading."
   exit 1
 elif [ "$COMMAND" = "snapshot" ] ; then
-  CLASS="org.apache.hadoop.hbase.snapshot.CreateSnapshot"
-elif [ "$COMMAND" = "snapshotinfo" ] ; then
-  CLASS="org.apache.hadoop.hbase.snapshot.SnapshotInfo"
+  SUBCOMMAND=$1
+  shift
+  if [ "$SUBCOMMAND" = "create" ] ; then
+    CLASS="org.apache.hadoop.hbase.snapshot.CreateSnapshot"
+  elif [ "$SUBCOMMAND" = "info" ] ; then
+    CLASS="org.apache.hadoop.hbase.snapshot.SnapshotInfo"
+  elif [ "$SUBCOMMAND" = "export" ] ; then
+    CLASS="org.apache.hadoop.hbase.snapshot.ExportSnapshot"
+  else
+    echo "Usage: hbase [<options>] snapshot <subcommand> [<args>]"
+    echo "$options_string"
+    echo ""
+    echo "Subcommands:"
+    echo "  create          Create a new snapshot of a table"
+    echo "  info            Tool for dumping snapshot information"
+    echo "  export          Export an existing snapshot"
+    exit 1
+  fi
 elif [ "$COMMAND" = "master" ] ; then
   CLASS='org.apache.hadoop.hbase.master.HMaster'
   if [ "$1" != "stop" ] && [ "$1" != "clear" ] ; then

http://git-wip-us.apache.org/repos/asf/hbase/blob/7177e4be/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java
index d17e36b..9734f43 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java
@@ -1057,11 +1057,11 @@ public class ExportSnapshot extends Configured implements Tool {
     System.err.println("  -bandwidth              Limit bandwidth to this value in MB/second.");
     System.err.println();
     System.err.println("Examples:");
-    System.err.println("  hbase " + getClass().getName() + " \\");
+    System.err.println("  hbase snapshot export \\");
     System.err.println("    -snapshot MySnapshot -copy-to hdfs://srv2:8082/hbase \\");
     System.err.println("    -chuser MyUser -chgroup MyGroup -chmod 700 -mappers 16");
     System.err.println();
-    System.err.println("  hbase " + getClass().getName() + " \\");
+    System.err.println("  hbase snapshot export \\");
     System.err.println("    -snapshot MySnapshot -copy-from hdfs://srv2:8082/hbase \\");
     System.err.println("    -copy-to hdfs://srv1:50070/hbase \\");
     System.exit(1);

http://git-wip-us.apache.org/repos/asf/hbase/blob/7177e4be/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
index 95803f5..0a359f8 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
@@ -467,7 +467,7 @@ public final class SnapshotInfo extends Configured implements Tool {
   }
 
   private void printUsageAndExit() {
-    System.err.printf("Usage: bin/hbase %s [options]%n", getClass().getName());
+    System.err.printf("Usage: bin/hbase snapshot info [options]%n");
     System.err.println(" where [options] are:");
     System.err.println("  -h|-help                Show this help and exit.");
     System.err.println("  -remote-dir             Root directory that contains the snapshots.");
@@ -479,7 +479,7 @@ public final class SnapshotInfo extends Configured implements Tool {
     System.err.println("  -schema                 Describe the snapshotted table.");
     System.err.println();
     System.err.println("Examples:");
-    System.err.println("  hbase " + getClass() + " \\");
+    System.err.println("  hbase snapshot info \\");
     System.err.println("    -snapshot MySnapshot -files");
     System.exit(1);
   }


Mime
View raw message