Commits

dizzyd  committed 81dc7d0

Replacing backup/restore with hooks in riak-admin

  • Participants
  • Parent commits 2ecf6f1

Comments (0)

Files changed (3)

File rel/overlay/bin/riak-admin

         $NODETOOL rpc riak_console join $@
         ;;
 
-    backup)
-        ;;
+    backup | restore)
+        ACTION=$1
+        shift
 
-    restore)
+        if [ $# -lt 3 ]; then
+            echo "Usage: $SCRIPT $ACTION <node> <cookie> <filename>"
+            exit 1
+        fi
+
+        NODE=$1
+        COOKIE=$2
+        FILENAME=$3
+
+        $ERTS_PATH/erl -noshell -name riak_backup -setcookie $COOKIE \
+                       -eval "riak_backup:$ACTION('$NODE', \"$FILENAME\")" -s init stop
         ;;
 
     *)

File start-backup.sh

-#!/usr/bin/env bash
-# ./start-backup.sh <node> <cookie> <filename>
-#
-# This will:
-#  1. Join riak cluster of which <node> is a member, using <cookie>.
-#  2. Dump the entire cluster's contents to <filename>.
-
-if [ $# -lt 3 ]; then
-    echo Usage: 1>&2
-    echo "    `basename $0` <node> <cookie> <filename>" 1>&2
-    exit 1
-fi
-. riak-env.sh
-NODE=$1
-COOKIE=$2
-FILENAME=$3
-erl -noshell -pa deps/*/ebin -pa ebin -name riak_backup -setcookie $COOKIE -eval "riak_backup:backup('$NODE', \"$FILENAME\")." -run init stop

File start-restore.sh

-#!/usr/bin/env bash
-# ./start-restore.sh<node> <cookie> <filename>
-# This will:
-#  1. Join riak cluster of which <node> is a member, using <cookie>.
-#  2. Overwrite cluster data with data contained in <filename>
-
-if [ $# -lt 3 ]; then
-    echo Usage: 1>&2
-    echo "    `basename $0` <node> <cookie> <filename>" 1>&2
-    exit 1
-fi
-. riak-env.sh
-NODE=$1
-COOKIE=$2
-FILENAME=$3
-erl -noshell -pa deps/*/ebin -pa ebin -name riak_restore -setcookie $COOKIE -eval "riak_backup:restore('$NODE', \"$FILENAME\")." -run init stop