hbase 定时备份
#!/bin/bash
#su - hdfs <<EOF
data1=`date "+%Y%m%d%H%M%S"`
data2="/user/news/hbase_backup/back${data1}"
data3="back${data1}.tar.gz"
data4="back${data1}"
echo '-----------'
echo $data1
echo $data2
echo $data3
echo $data4
echo '----------'
su - hdfs <<EOF
hbase org.apache.hadoop.hbase.mapreduce.Driver export news $data2
hadoop dfs -get $data2 /dfs/backup/
exit;
EOF
cd /dfs/backup/
tar -czf $data3 $data4
rm -rf $data4
deldata1=`date -d "15 day ago" +"%Y%m%d"`
deldata2="back${deldata1}*"
echo "------------"
echo $deldata1
echo "-------"
echo $deldata2
echo "----------"
rm -rf $deldata2