taking checkpoint
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization_ioc_installer@1314 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-events/src/main/resources/events/backup/backup.sh b/asterix-events/src/main/resources/events/backup/backup.sh
index cff37df..e10a4c9 100755
--- a/asterix-events/src/main/resources/events/backup/backup.sh
+++ b/asterix-events/src/main/resources/events/backup/backup.sh
@@ -2,18 +2,34 @@
ASTERIX_INSTANCE_NAME=$2
ASTERIX_DATA_DIR=$3
BACKUP_ID=$4
-HDFS_URL=$5
-HADOOP_VERSION=$6
-HDFS_BACKUP_DIR=$7
-NODE_ID=$8
-
-export HADOOP_HOME=$WORKING_DIR/hadoop-$HADOOP_VERSION
+BACKUP_DIR=$5
+BACKUP_TYPE=$6
+NODE_ID=$7
nodeStores=$(echo $ASTERIX_DATA_DIR | tr "," "\n")
-for nodeStore in $nodeStores
-do
- NODE_BACKUP_DIR=$HDFS_BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$nodeStore
- $HADOOP_HOME/bin/hadoop fs -mkdir $HDFS_URL/$NODE_BACKUP_DIR
- echo "$HADOOP_HOME/bin/hadoop fs -copyFromLocal $nodeStore/$NODE_ID $HDFS_URL/$NODE_BACKUP_DIR" >> ~/backup.log
- $HADOOP_HOME/bin/hadoop fs -copyFromLocal $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/* $HDFS_URL/$NODE_BACKUP_DIR/
-done
+
+if [ $BACKUP_TYPE == "hdfs" ];
+then
+ HDFS_URL=$8
+ HADOOP_VERSION=$9
+ export HADOOP_HOME=$WORKING_DIR/hadoop-$HADOOP_VERSION
+ for nodeStore in $nodeStores
+ do
+ MANGLED_DIR_NAME=`echo $nodeStores | tr / _`
+ NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$MANGLED_DIR_NAME
+ echo "$HADOOP_HOME/bin/hadoop fs -copyFromLocal $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/ $HDFS_URL/$NODE_BACKUP_DIR/" >> ~/backup.log
+ $HADOOP_HOME/bin/hadoop fs -copyFromLocal $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/ $HDFS_URL/$NODE_BACKUP_DIR/
+ done
+else
+ for nodeStore in $nodeStores
+ do
+ MANGLED_DIR_NAME=`echo $nodeStores | tr / _`
+ NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$MANGLED_DIR_NAME
+ if [ ! -d $NODE_BACKUP_DIR ];
+ then
+ mkdir -p $NODE_BACKUP_DIR
+ fi
+ echo "cp -r $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/* $NODE_BACKUP_DIR/" >> ~/backup.log
+ cp -r $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/* $NODE_BACKUP_DIR/
+ done
+fi
diff --git a/asterix-events/src/main/resources/events/events.xml b/asterix-events/src/main/resources/events/events.xml
index 857ee5a..f85e3ea 100644
--- a/asterix-events/src/main/resources/events/events.xml
+++ b/asterix-events/src/main/resources/events/events.xml
@@ -97,4 +97,10 @@
<args>WorkingDir HadoopVersion HDFSUrl Path_to_Delete</args>
<daemon>false</daemon>
</event>
+ <event>
+ <type>node_info</type>
+ <script>node_info/node_info.sh</script>
+ <description>Retrieved environment information for a node</description>
+ <daemon>false</daemon>
+ </event>
</events>
diff --git a/asterix-events/src/main/resources/events/node_info/node_info.sh b/asterix-events/src/main/resources/events/node_info/node_info.sh
new file mode 100755
index 0000000..ae72490
--- /dev/null
+++ b/asterix-events/src/main/resources/events/node_info/node_info.sh
@@ -0,0 +1,4 @@
+JAVA_VERSION=`java -version 2>&1 |awk 'NR==1{ gsub(/"/,""); print $3 }'`
+HOME_DIR=`echo ~`
+echo JAVA_VERSION=$JAVA_VERSION
+echo HOME_DIR=$HOME_DIR
diff --git a/asterix-events/src/main/resources/events/restore/restore.sh b/asterix-events/src/main/resources/events/restore/restore.sh
index 96f3db4..515efc1 100755
--- a/asterix-events/src/main/resources/events/restore/restore.sh
+++ b/asterix-events/src/main/resources/events/restore/restore.sh
@@ -2,17 +2,19 @@
ASTERIX_INSTANCE_NAME=$2
ASTERIX_DATA_DIR=$3
BACKUP_ID=$4
-HDFS_URL=$5
-HADOOP_VERSION=$6
-HDFS_BACKUP_DIR=$7
-NODE_ID=$8
+BACKUP_DIR=$5
+BACKUP_TYPE=$6
+NODE_ID=$7
+HDFS_URL=$8
+HADOOP_VERSION=$9
export HADOOP_HOME=$WORKING_DIR/hadoop-$HADOOP_VERSION
-
nodeStores=$(echo $ASTERIX_DATA_DIR | tr "," "\n")
+
for nodeStore in $nodeStores
do
- NODE_BACKUP_DIR=$HDFS_BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$nodeStore
+ MANGLED_BACKUP_DIR=`echo $nodeStore | tr / _`
+ NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$MANGLED_BACKUP_DIR
DEST_DIR=$nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME
if [ ! -d $DEST_DIR ]
then
@@ -20,6 +22,11 @@
else
rm -rf $DEST_DIR/*
fi
- echo "$HADOOP_HOME/bin/hadoop fs -copyToLocal $HDFS_URL/$NODE_BACKUP_DIR/ $DEST_DIR/" >> ~/restore.log
- $HADOOP_HOME/bin/hadoop fs -copyToLocal $HDFS_URL/$NODE_BACKUP_DIR/* $DEST_DIR/
+
+ if [ $BACKUP_TYPE == "hdfs" ];
+ then
+ $HADOOP_HOME/bin/hadoop fs -copyToLocal $HDFS_URL/$NODE_BACKUP_DIR/* $DEST_DIR/
+ else
+ cp -r $NODE_BACKUP_DIR/* $DEST_DIR/
+ fi
done