blob: e10a4c9ba97a21b1940de0e5ceae77e243ee95a0 [file] [log] [blame]
ramangrover29116eb972013-02-20 20:47:35 +00001WORKING_DIR=$1
2ASTERIX_INSTANCE_NAME=$2
3ASTERIX_DATA_DIR=$3
4BACKUP_ID=$4
ramangrover29@gmail.com73bf75e2013-03-11 01:41:42 +00005BACKUP_DIR=$5
6BACKUP_TYPE=$6
7NODE_ID=$7
ramangrover29116eb972013-02-20 20:47:35 +00008
9nodeStores=$(echo $ASTERIX_DATA_DIR | tr "," "\n")
ramangrover29@gmail.com73bf75e2013-03-11 01:41:42 +000010
11if [ $BACKUP_TYPE == "hdfs" ];
12then
13 HDFS_URL=$8
14 HADOOP_VERSION=$9
15 export HADOOP_HOME=$WORKING_DIR/hadoop-$HADOOP_VERSION
16 for nodeStore in $nodeStores
17 do
18 MANGLED_DIR_NAME=`echo $nodeStores | tr / _`
19 NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$MANGLED_DIR_NAME
20 echo "$HADOOP_HOME/bin/hadoop fs -copyFromLocal $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/ $HDFS_URL/$NODE_BACKUP_DIR/" >> ~/backup.log
21 $HADOOP_HOME/bin/hadoop fs -copyFromLocal $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/ $HDFS_URL/$NODE_BACKUP_DIR/
22 done
23else
24 for nodeStore in $nodeStores
25 do
26 MANGLED_DIR_NAME=`echo $nodeStores | tr / _`
27 NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$MANGLED_DIR_NAME
28 if [ ! -d $NODE_BACKUP_DIR ];
29 then
30 mkdir -p $NODE_BACKUP_DIR
31 fi
32 echo "cp -r $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/* $NODE_BACKUP_DIR/" >> ~/backup.log
33 cp -r $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/* $NODE_BACKUP_DIR/
34 done
35fi