1.backup.sh
#!/usr/bin/env bash
if [ $# -lt 2 ] ; then
echo "usage: $0 <namespace> <tablename> [ <tablename> ... ]"
exit 0
fi
namespace=$1
shift
while [ $# -ge 1 ]; do
echo "Backing up '${namespace}/$1' ..."
echo "USE '${namespace}';" > create-table-$1.hql
echo "USE '${namespace}'; SHOW CREATE TABLE '$1';" | /opt/hypertable/current/bin/ht shell --silent >> create-table-$1.hql
echo ";" >> create-table-$1.hql
echo "Dumping table to local"
echo "USE '${namespace}'; DUMP TABLE '$1' INTO FILE '$1.gz';" | /opt/hypertable/current/bin/ht shell
#echo "Dumping table to hdfs"
#echo "USE '${namespace}'; DUMP TABLE '$1' INTO FILE 'dfs:\\$1.gz';" | /opt/hypertable/current/b