ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 1 | WORKING_DIR=$1 |
| 2 | ASTERIX_INSTANCE_NAME=$2 |
| 3 | ASTERIX_DATA_DIR=$3 |
| 4 | BACKUP_ID=$4 |
ramangrover29@gmail.com | 73bf75e | 2013-03-11 01:41:42 +0000 | [diff] [blame] | 5 | BACKUP_DIR=$5 |
| 6 | BACKUP_TYPE=$6 |
| 7 | NODE_ID=$7 |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 8 | |
| 9 | nodeStores=$(echo $ASTERIX_DATA_DIR | tr "," "\n") |
ramangrover29@gmail.com | 73bf75e | 2013-03-11 01:41:42 +0000 | [diff] [blame] | 10 | |
| 11 | if [ $BACKUP_TYPE == "hdfs" ]; |
| 12 | then |
| 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 |
| 23 | else |
| 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 |
| 35 | fi |