You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/06/17 08:54:31 UTC
[22/41] ignite git commit: IGNITE-1371 Implemented Cassandra cache
store.
http://git-wip-us.apache.org/repos/asf/ignite/blob/83c26a91/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-bootstrap.sh
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-bootstrap.sh b/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-bootstrap.sh
new file mode 100644
index 0000000..a3a0601
--- /dev/null
+++ b/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-bootstrap.sh
@@ -0,0 +1,384 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+AWS_CLI_DOWNLOAD_URL=https://s3.amazonaws.com/aws-cli/awscli-bundle.zip
+
+S3_ROOT=s3://bucket/folder
+S3_DOWNLOADS=$S3_ROOT/test
+S3_SYSTEM=$S3_ROOT/test1
+
+IGNITE_DOWNLOAD_URL=$S3_DOWNLOADS/apache-ignite-fabric-1.6.0-SNAPSHOT-bin.zip
+IGNITE_ZIP=apache-ignite-fabric-1.6.0-SNAPSHOT-bin.zip
+IGNITE_UNZIP_DIR=apache-ignite-fabric-1.6.0-SNAPSHOT-bin
+
+TESTS_PACKAGE_DONLOAD_URL=$S3_DOWNLOADS/ignite-cassandra-tests-1.6.0-SNAPSHOT.zip
+TESTS_PACKAGE_ZIP=ignite-cassandra-tests-1.6.0-SNAPSHOT.zip
+TESTS_PACKAGE_UNZIP_DIR=ignite-cassandra-tests
+
+S3_LOGS_URL=$S3_SYSTEM/logs/i-logs
+S3_LOGS_TRIGGER_URL=$S3_SYSTEM/logs-trigger
+S3_BOOTSTRAP_SUCCESS_URL=$S3_SYSTEM/i-success
+S3_BOOTSTRAP_FAILURE_URL=$S3_SYSTEM/i-failure
+S3_CASSANDRA_NODES_DISCOVERY_URL=$S3_SYSTEM/c-discovery
+S3_IGNITE_NODES_DISCOVERY_URL=$S3_SYSTEM/i-discovery
+S3_IGNITE_FIRST_NODE_LOCK_URL=$S3_SYSTEM/i-first-node-lock
+S3_IGNITE_NODES_JOIN_LOCK_URL=$S3_SYSTEM/i-join-lock
+
+INSTANCE_REGION=us-west-2
+INSTANCE_NAME_TAG=IGNITE-SERVER
+INSTANCE_OWNER_TAG=ignite@apache.org
+INSTANCE_PROJECT_TAG=ignite
+
+terminate()
+{
+ if [[ "$S3_BOOTSTRAP_SUCCESS_URL" != */ ]]; then
+ S3_BOOTSTRAP_SUCCESS_URL=${S3_BOOTSTRAP_SUCCESS_URL}/
+ fi
+
+ if [[ "$S3_BOOTSTRAP_FAILURE_URL" != */ ]]; then
+ S3_BOOTSTRAP_FAILURE_URL=${S3_BOOTSTRAP_FAILURE_URL}/
+ fi
+
+ host_name=$(hostname -f | tr '[:upper:]' '[:lower:]')
+ msg=$host_name
+
+ if [ -n "$1" ]; then
+ echo "[ERROR] $1"
+ echo "[ERROR]-----------------------------------------------------"
+ echo "[ERROR] Ignite node bootstrap failed"
+ echo "[ERROR]-----------------------------------------------------"
+ msg=$1
+ reportFolder=${S3_BOOTSTRAP_FAILURE_URL}${host_name}
+ reportFile=$reportFolder/__error__
+ else
+ echo "[INFO]-----------------------------------------------------"
+ echo "[INFO] Ignite node bootstrap successfully completed"
+ echo "[INFO]-----------------------------------------------------"
+ reportFolder=${S3_BOOTSTRAP_SUCCESS_URL}${host_name}
+ reportFile=$reportFolder/__success__
+ fi
+
+ echo $msg > /opt/bootstrap-result
+
+ aws s3 rm --recursive $reportFolder
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed drop report folder: $reportFolder"
+ fi
+
+ aws s3 cp --sse AES256 /opt/bootstrap-result $reportFile
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to report bootstrap result to: $reportFile"
+ fi
+
+ rm -f /opt/bootstrap-result
+
+ if [ -n "$1" ]; then
+ exit 1
+ fi
+
+ exit 0
+}
+
+tagInstance()
+{
+ export EC2_HOME=/opt/aws/apitools/ec2
+ export JAVA_HOME=/opt/jdk1.8.0_77
+ export PATH=$JAVA_HOME/bin:$EC2_HOME/bin:$PATH
+
+ INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
+ if [ $? -ne 0 ]; then
+ terminate "Failed to get instance metadata to tag it"
+ fi
+
+ if [ -n "$INSTANCE_NAME_TAG" ]; then
+ ec2-create-tags $INSTANCE_ID --tag Name=${INSTANCE_NAME_TAG} --region $INSTANCE_REGION
+ if [ $code -ne 0 ]; then
+ terminate "Failed to tag EC2 instance with: Name=${INSTANCE_NAME_TAG}"
+ fi
+ fi
+
+ if [ -n "$INSTANCE_OWNER_TAG" ]; then
+ ec2-create-tags $INSTANCE_ID --tag owner=${INSTANCE_OWNER_TAG} --region $INSTANCE_REGION
+ if [ $code -ne 0 ]; then
+ terminate "Failed to tag EC2 instance with: owner=${INSTANCE_OWNER_TAG}"
+ fi
+ fi
+
+ if [ -n "$INSTANCE_PROJECT_TAG" ]; then
+ ec2-create-tags $INSTANCE_ID --tag project=${INSTANCE_PROJECT_TAG} --region $INSTANCE_REGION
+ if [ $code -ne 0 ]; then
+ terminate "Failed to tag EC2 instance with: project=${INSTANCE_PROJECT_TAG}"
+ fi
+ fi
+}
+
+downloadPackage()
+{
+ echo "[INFO] Downloading $3 package from $1 into $2"
+
+ if [[ "$1" == s3* ]]; then
+ aws s3 cp $1 $2
+
+ if [ $? -ne 0 ]; then
+ echo "[WARN] Failed to download $3 package from first attempt"
+ rm -Rf $2
+ sleep 10s
+
+ echo "[INFO] Trying second attempt to download $3 package"
+ aws s3 cp $1 $2
+
+ if [ $? -ne 0 ]; then
+ echo "[WARN] Failed to download $3 package from second attempt"
+ rm -Rf $2
+ sleep 10s
+
+ echo "[INFO] Trying third attempt to download $3 package"
+ aws s3 cp $1 $2
+
+ if [ $? -ne 0 ]; then
+ terminate "All three attempts to download $3 package from $1 are failed"
+ fi
+ fi
+ fi
+ else
+ curl "$1" -o "$2"
+
+ if [ $? -ne 0 ] && [ $? -ne 6 ]; then
+ echo "[WARN] Failed to download $3 package from first attempt"
+ rm -Rf $2
+ sleep 10s
+
+ echo "[INFO] Trying second attempt to download $3 package"
+ curl "$1" -o "$2"
+
+ if [ $? -ne 0 ] && [ $? -ne 6 ]; then
+ echo "[WARN] Failed to download $3 package from second attempt"
+ rm -Rf $2
+ sleep 10s
+
+ echo "[INFO] Trying third attempt to download $3 package"
+ curl "$1" -o "$2"
+
+ if [ $? -ne 0 ] && [ $? -ne 6 ]; then
+ terminate "All three attempts to download $3 package from $1 are failed"
+ fi
+ fi
+ fi
+ fi
+
+ echo "[INFO] $3 package successfully downloaded from $1 into $2"
+}
+
+if [[ "$S3_IGNITE_NODES_DISCOVERY_URL" != */ ]]; then
+ S3_IGNITE_NODES_DISCOVERY_URL=${S3_IGNITE_NODES_DISCOVERY_URL}/
+fi
+
+if [[ "$S3_CASSANDRA_NODES_DISCOVERY_URL" != */ ]]; then
+ S3_CASSANDRA_NODES_DISCOVERY_URL=${S3_CASSANDRA_NODES_DISCOVERY_URL}/
+fi
+
+echo "[INFO]-----------------------------------------------------------------"
+echo "[INFO] Bootstrapping Ignite node"
+echo "[INFO]-----------------------------------------------------------------"
+echo "[INFO] Ignite download URL: $IGNITE_DOWNLOAD_URL"
+echo "[INFO] Tests package download URL: $TESTS_PACKAGE_DONLOAD_URL"
+echo "[INFO] Logs URL: $S3_LOGS_URL"
+echo "[INFO] Logs trigger URL: $S3_LOGS_TRIGGER_URL"
+echo "[INFO] Ignite node discovery URL: $S3_IGNITE_NODES_DISCOVERY_URL"
+echo "[INFO] Ignite first node lock URL: $S3_IGNITE_FIRST_NODE_LOCK_URL"
+echo "[INFO] Ignite nodes join lock URL: $S3_IGNITE_NODES_JOIN_LOCK_URL"
+echo "[INFO] Cassandra node discovery URL: $S3_CASSANDRA_NODES_DISCOVERY_URL"
+echo "[INFO] Bootsrap success URL: $S3_BOOTSTRAP_SUCCESS_URL"
+echo "[INFO] Bootsrap failure URL: $S3_BOOTSTRAP_FAILURE_URL"
+echo "[INFO]-----------------------------------------------------------------"
+
+echo "[INFO] Installing 'wget' package"
+yum -y install wget
+if [ $? -ne 0 ]; then
+ terminate "Failed to install 'wget' package"
+fi
+
+echo "[INFO] Installing 'net-tools' package"
+yum -y install net-tools
+if [ $? -ne 0 ]; then
+ terminate "Failed to install 'net-tools' package"
+fi
+
+echo "[INFO] Installing 'python' package"
+yum -y install python
+if [ $? -ne 0 ]; then
+ terminate "Failed to install 'python' package"
+fi
+
+echo "[INFO] Installing 'unzip' package"
+yum -y install unzip
+if [ $? -ne 0 ]; then
+ terminate "Failed to install 'unzip' package"
+fi
+
+rm -Rf /opt/jdk1.8.0_77 /opt/jdk-8u77-linux-x64.tar.gz
+
+echo "[INFO] Downloading 'jdk-8u77'"
+wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u77-b03/jdk-8u77-linux-x64.tar.gz" -O /opt/jdk-8u77-linux-x64.tar.gz
+if [ $? -ne 0 ]; then
+ terminate "Failed to download 'jdk-8u77'"
+fi
+
+echo "[INFO] Unzipping 'jdk-8u77'"
+tar -xvzf /opt/jdk-8u77-linux-x64.tar.gz -C /opt
+if [ $? -ne 0 ]; then
+ terminate "Failed to untar 'jdk-8u77'"
+fi
+
+rm -Rf /opt/jdk-8u77-linux-x64.tar.gz
+
+downloadPackage "https://bootstrap.pypa.io/get-pip.py" "/opt/get-pip.py" "get-pip.py"
+
+echo "[INFO] Installing 'pip'"
+python /opt/get-pip.py
+if [ $? -ne 0 ]; then
+ terminate "Failed to install 'pip'"
+fi
+
+echo "[INFO] Installing 'awscli'"
+pip install --upgrade awscli
+if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to install 'awscli' using pip"
+ echo "[INFO] Trying to install awscli using zip archive"
+ echo "[INFO] Downloading awscli zip"
+
+ downloadPackage "$AWS_CLI_DOWNLOAD_URL" "/opt/awscli-bundle.zip" "awscli"
+
+ echo "[INFO] Unzipping awscli zip"
+ unzip /opt/awscli-bundle.zip -d /opt
+ if [ $? -ne 0 ]; then
+ terminate "Failed to unzip awscli zip"
+ fi
+
+ rm -fR /opt/awscli-bundle.zip
+
+ echo "[INFO] Installing awscli"
+ /opt/awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
+ if [ $? -ne 0 ]; then
+ terminate "Failed to install awscli"
+ fi
+
+ echo "[INFO] Successfully installed awscli from zip archive"
+fi
+
+tagInstance
+
+echo "[INFO] Creating 'ignite' group"
+exists=$(cat /etc/group | grep ignite)
+if [ -z "$exists" ]; then
+ groupadd ignite
+ if [ $? -ne 0 ]; then
+ terminate "Failed to create 'ignite' group"
+ fi
+fi
+
+echo "[INFO] Creating 'ignite' user"
+exists=$(cat /etc/passwd | grep ignite)
+if [ -z "$exists" ]; then
+ useradd -g ignite ignite
+ if [ $? -ne 0 ]; then
+ terminate "Failed to create 'ignite' user"
+ fi
+fi
+
+rm -Rf /opt/ignite /opt/$IGNITE_ZIP
+
+downloadPackage "$IGNITE_DOWNLOAD_URL" "/opt/$IGNITE_ZIP" "Ignite"
+
+echo "[INFO] Unzipping Ignite package"
+unzip /opt/$IGNITE_ZIP -d /opt
+if [ $? -ne 0 ]; then
+ terminate "Failed to unzip Ignite package"
+fi
+
+rm -Rf /opt/$IGNITE_ZIP /opt/ignite-start.sh /opt/ignite-env.sh /opt/ignite
+mv /opt/$IGNITE_UNZIP_DIR /opt/ignite
+chown -R ignite:ignite /opt/ignite
+
+downloadPackage "$TESTS_PACKAGE_DONLOAD_URL" "/opt/$TESTS_PACKAGE_ZIP" "Tests"
+
+unzip /opt/$TESTS_PACKAGE_ZIP -d /opt
+if [ $? -ne 0 ]; then
+ terminate "Failed to unzip tests package: $TESTS_PACKAGE_DONLOAD_URL"
+fi
+
+chown -R ignite:ignite /opt/$TESTS_PACKAGE_UNZIP_DIR
+find /opt/$TESTS_PACKAGE_UNZIP_DIR -type f -name "*.sh" -exec chmod ug+x {} \;
+
+if [ ! -f "/opt/$TESTS_PACKAGE_UNZIP_DIR/bootstrap/aws/ignite/ignite-start.sh" ]; then
+ terminate "There are no ignite-start.sh in tests package"
+fi
+
+if [ ! -f "/opt/$TESTS_PACKAGE_UNZIP_DIR/bootstrap/aws/ignite/ignite-cassandra-server-template.xml" ]; then
+ terminate "There are no ignite-cassandra-server-template.xml in tests package"
+fi
+
+if [ ! -f "/opt/$TESTS_PACKAGE_UNZIP_DIR/bootstrap/aws/logs-collector.sh" ]; then
+ terminate "There are no logs-collector.sh in tests package"
+fi
+
+testsJar=$(find /opt/$TESTS_PACKAGE_UNZIP_DIR -type f -name "*.jar" | grep ignite-cassandra- | grep tests.jar)
+if [ -n "$testsJar" ]; then
+ echo "[INFO] Coping tests jar $testsJar into /opt/ignite/libs/optional/ignite-cassandra"
+ cp $testsJar /opt/ignite/libs/optional/ignite-cassandra
+ if [ $? -ne 0 ]; then
+ terminate "Failed copy $testsJar into /opt/ignite/libs/optional/ignite-cassandra"
+ fi
+fi
+
+mv -f /opt/$TESTS_PACKAGE_UNZIP_DIR/bootstrap/aws/ignite/ignite-start.sh /opt
+mv -f /opt/$TESTS_PACKAGE_UNZIP_DIR/bootstrap/aws/ignite/ignite-cassandra-server-template.xml /opt/ignite/config
+mv -f /opt/$TESTS_PACKAGE_UNZIP_DIR/bootstrap/aws/logs-collector.sh /opt
+
+if [ -f "/opt/$TESTS_PACKAGE_UNZIP_DIR/bootstrap/aws/ignite/ignite-env.sh" ]; then
+ mv -f /opt/$TESTS_PACKAGE_UNZIP_DIR/bootstrap/aws/ignite/ignite-env.sh /opt
+ chown -R ignite:ignite /opt/ignite-env.sh
+fi
+
+rm -Rf /opt/$TESTS_PACKAGE_UNZIP_DIR
+chown -R ignite:ignite /opt/ignite-start.sh /opt/logs-collector.sh /opt/ignite/config/ignite-cassandra-server-template.xml
+
+#profile=/home/ignite/.bash_profile
+profile=/root/.bash_profile
+
+echo "export JAVA_HOME=/opt/jdk1.8.0_77" >> $profile
+echo "export IGNITE_HOME=/opt/ignite" >> $profile
+echo "export USER_LIBS=\$IGNITE_HOME/libs/optional/ignite-cassandra/*:\$IGNITE_HOME/libs/optional/ignite-slf4j/*" >> $profile
+echo "export PATH=\$JAVA_HOME/bin:\IGNITE_HOME/bin:\$PATH" >> $profile
+echo "export S3_BOOTSTRAP_SUCCESS_URL=$S3_BOOTSTRAP_SUCCESS_URL" >> $profile
+echo "export S3_BOOTSTRAP_FAILURE_URL=$S3_BOOTSTRAP_FAILURE_URL" >> $profile
+echo "export S3_CASSANDRA_NODES_DISCOVERY_URL=$S3_CASSANDRA_NODES_DISCOVERY_URL" >> $profile
+echo "export S3_IGNITE_NODES_DISCOVERY_URL=$S3_IGNITE_NODES_DISCOVERY_URL" >> $profile
+echo "export S3_IGNITE_NODES_JOIN_LOCK_URL=$S3_IGNITE_NODES_JOIN_LOCK_URL" >> $profile
+echo "export S3_IGNITE_FIRST_NODE_LOCK_URL=$S3_IGNITE_FIRST_NODE_LOCK_URL" >> $profile
+
+HOST_NAME=$(hostname -f | tr '[:upper:]' '[:lower:]')
+
+/opt/logs-collector.sh "/opt/ignite/work/log" "$S3_LOGS_URL/$HOST_NAME" "$S3_LOGS_TRIGGER_URL" > /opt/ignite/logs-collector.log &
+
+cmd="/opt/ignite-start.sh"
+
+#sudo -u ignite -g ignite sh -c "$cmd | tee /opt/ignite/start.log"
+
+$cmd | tee /opt/ignite/start.log
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/83c26a91/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml b/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml
new file mode 100644
index 0000000..f85dcd9
--- /dev/null
+++ b/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd">
+
+ <!-- Cassandra connection settings -->
+ <bean id="loadBalancingPolicy" class="com.datastax.driver.core.policies.RoundRobinPolicy"/>
+
+ <util:list id="contactPoints" value-type="java.lang.String">
+ ${CASSANDRA_SEEDS}
+ </util:list>
+
+ <bean id="cassandraAdminDataSource" class="org.apache.ignite.cache.store.cassandra.datasource.DataSource">
+ <property name="user" value="cassandra"/>
+ <property name="password" value="cassandra"/>
+ <property name="contactPoints" ref="contactPoints"/>
+ <property name="readConsistency" value="ONE"/>
+ <property name="writeConsistency" value="ONE"/>
+ <property name="loadBalancingPolicy" ref="loadBalancingPolicy"/>
+ </bean>
+
+ <!-- Persistence settings for 'cache1' -->
+ <bean id="cache1_settings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
+ <constructor-arg type="java.lang.String">
+ <value><![CDATA[
+<persistence keyspace="test1" table="primitive_test1">
+ <keyPersistence class="java.lang.Long" strategy="PRIMITIVE" column="key"/>
+ <valuePersistence class="java.lang.Long" strategy="PRIMITIVE" column="value"/>
+</persistence>]]>
+ </value>
+ </constructor-arg>
+ </bean>
+
+ <!-- Persistence settings for 'cache2' -->
+ <bean id="cache2_settings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
+ <constructor-arg type="java.lang.String">
+ <value><![CDATA[
+<persistence keyspace="test1" table="blob_test1">
+ <keyPersistence class="java.lang.Long" strategy="PRIMITIVE" />
+ <valuePersistence strategy="BLOB"/>
+</persistence>]]>
+ </value>
+ </constructor-arg>
+ </bean>
+
+ <!-- Persistence settings for 'cache3' -->
+ <bean id="cache3_settings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
+ <constructor-arg type="java.lang.String">
+ <value><![CDATA[
+<persistence keyspace="test1" table="pojo_test3" ttl="86400">
+ <keyspaceOptions>
+ REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 3}
+ AND DURABLE_WRITES = true
+ </keyspaceOptions>
+ <tableOptions>
+ comment = 'A most excellent and useful table'
+ AND read_repair_chance = 0.2
+ </tableOptions>
+ <keyPersistence class="org.apache.ignite.tests.pojos.PersonId" strategy="POJO">
+ <partitionKey>
+ <field name="companyCode" column="company" />
+ <field name="departmentCode" column="department" />
+ </partitionKey>
+ <clusterKey>
+ <field name="personNumber" column="number" sort="desc"/>
+ </clusterKey>
+ </keyPersistence>
+ <valuePersistence class="org.apache.ignite.tests.pojos.Person"
+ strategy="POJO"
+ serializer="org.apache.ignite.cache.store.cassandra.serializer.KryoSerializer">
+ <field name="firstName" column="first_name" />
+ <field name="lastName" column="last_name" />
+ <field name="age" />
+ <field name="married" index="true"/>
+ <field name="height" />
+ <field name="weight" />
+ <field name="birthDate" column="birth_date" />
+ <field name="phones" />
+ </valuePersistence>
+</persistence>]]>
+ </value>
+ </constructor-arg>
+ </bean>
+
+ <!-- Ignite configuration -->
+ <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+
+ <property name="cacheConfiguration">
+ <list>
+ <!-- Partitioned cache example configuration (Atomic mode). -->
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="atomicityMode" value="ATOMIC"/>
+ <property name="backups" value="1"/>
+ </bean>
+
+ <!-- Configuring persistence for "cache1" cache -->
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="cache1"/>
+ <property name="readThrough" value="true"/>
+ <property name="writeThrough" value="true"/>
+ <property name="writeBehindEnabled" value="true"/>
+ <property name="cacheStoreFactory">
+ <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
+ <property name="dataSourceBean" value="cassandraAdminDataSource"/>
+ <property name="persistenceSettingsBean" value="cache1_settings"/>
+ </bean>
+ </property>
+ </bean>
+
+ <!-- Configuring persistence for "cache2" cache -->
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="cache2"/>
+ <property name="readThrough" value="true"/>
+ <property name="writeThrough" value="true"/>
+ <property name="writeBehindEnabled" value="true"/>
+ <property name="cacheStoreFactory">
+ <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
+ <property name="dataSourceBean" value="cassandraAdminDataSource"/>
+ <property name="persistenceSettingsBean" value="cache2_settings"/>
+ </bean>
+ </property>
+ </bean>
+
+ <!-- Configuring persistence for "cache3" cache -->
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="cache3"/>
+ <property name="readThrough" value="true"/>
+ <property name="writeThrough" value="true"/>
+ <property name="writeBehindEnabled" value="true"/>
+ <property name="cacheStoreFactory">
+ <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
+ <property name="dataSourceBean" value="cassandraAdminDataSource"/>
+ <property name="persistenceSettingsBean" value="cache3_settings"/>
+ </bean>
+ </property>
+ </bean>
+
+ </list>
+ </property>
+
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+ <property name="addresses">
+ <list>
+ ${IGNITE_SEEDS}
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/83c26a91/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-env.sh
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-env.sh b/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-env.sh
new file mode 100644
index 0000000..e0643b7
--- /dev/null
+++ b/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-env.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+JVM_OPTS="-Xms10g -Xmx10g -server -XX:+AggressiveOpts -XX:MaxMetaspaceSize=256m"
+JVM_OPTS="$JVM_OPTS -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+UseTLAB -XX:NewSize=128m -XX:MaxNewSize=768m"
+#JVM_OPTS="$JVM_OPTS -XX:MaxTenuringThreshold=0 -XX:SurvivorRatio=1024 -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=60"
+JVM_OPTS="$JVM_OPTS -Xss16m"
+
+export JVM_OPTS
http://git-wip-us.apache.org/repos/asf/ignite/blob/83c26a91/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-start.sh
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-start.sh b/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-start.sh
new file mode 100644
index 0000000..bb1ff0c
--- /dev/null
+++ b/modules/cassandra/src/test/bootstrap/aws/ignite/ignite-start.sh
@@ -0,0 +1,637 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#profile=/home/ignite/.bash_profile
+profile=/root/.bash_profile
+
+. $profile
+
+terminate()
+{
+ if [[ "$S3_BOOTSTRAP_SUCCESS_URL" != */ ]]; then
+ S3_BOOTSTRAP_SUCCESS_URL=${S3_BOOTSTRAP_SUCCESS_URL}/
+ fi
+
+ if [[ "$S3_BOOTSTRAP_FAILURE_URL" != */ ]]; then
+ S3_BOOTSTRAP_FAILURE_URL=${S3_BOOTSTRAP_FAILURE_URL}/
+ fi
+
+ msg=$HOST_NAME
+
+ if [ -n "$1" ]; then
+ echo "[ERROR] $1"
+ echo "[ERROR]-----------------------------------------------------"
+ echo "[ERROR] Failed to start Ignite node"
+ echo "[ERROR]-----------------------------------------------------"
+ msg=$1
+ reportFolder=${S3_BOOTSTRAP_FAILURE_URL}${HOST_NAME}
+ reportFile=$reportFolder/__error__
+ else
+ echo "[INFO]-----------------------------------------------------"
+ echo "[INFO] Ignite node successfully started"
+ echo "[INFO]-----------------------------------------------------"
+ reportFolder=${S3_BOOTSTRAP_SUCCESS_URL}${HOST_NAME}
+ reportFile=$reportFolder/__success__
+ fi
+
+ echo $msg > /opt/ignite/start_result
+
+ aws s3 rm --recursive $reportFolder
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed drop report folder: $reportFolder"
+ fi
+
+ if [ -d "/opt/ignite/work/log" ]; then
+ aws s3 sync --sse AES256 /opt/ignite/work/log $reportFolder
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to export Ignite logs to: $reportFolder"
+ fi
+ fi
+
+ aws s3 cp --sse AES256 /opt/ignite/start_result $reportFile
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to export node start result to: $reportFile"
+ fi
+
+ rm -f /opt/ignite/start_result /opt/ignite/join-lock /opt/ignite/remote-join-lock
+
+ if [ -n "$1" ]; then
+ exit 1
+ fi
+
+ exit 0
+}
+
+registerNode()
+{
+ echo "[INFO] Registering Ignite node seed: ${S3_IGNITE_NODES_DISCOVERY_URL}$HOST_NAME"
+
+ aws s3 cp --sse AES256 /opt/ignite/join-lock ${S3_IGNITE_NODES_DISCOVERY_URL}$HOST_NAME
+ if [ $? -ne 0 ]; then
+ terminate "Failed to register Ignite node seed: ${S3_IGNITE_NODES_DISCOVERY_URL}$HOST_NAME"
+ fi
+
+ echo "[INFO] Ignite node seed successfully registered"
+}
+
+unregisterNode()
+{
+ echo "[INFO] Removing Ignite node registration from: ${S3_IGNITE_NODES_DISCOVERY_URL}$HOST_NAME"
+ aws s3 rm ${S3_IGNITE_NODES_DISCOVERY_URL}$HOST_NAME
+ echo "[INFO] Ignite node registration removed"
+}
+
+cleanupMetadata()
+{
+ echo "[INFO] Running cleanup"
+ aws s3 rm $S3_IGNITE_NODES_JOIN_LOCK_URL
+ aws s3 rm --recursive $S3_IGNITE_NODES_DISCOVERY_URL
+ aws s3 rm --recursive $S3_BOOTSTRAP_SUCCESS_URL
+ aws s3 rm --recursive $S3_BOOTSTRAP_FAILURE_URL
+ echo "[INFO] Cleanup completed"
+}
+
+setupCassandraSeeds()
+{
+ echo "[INFO] Setting up Cassandra seeds"
+
+ echo "[INFO] Looking for Cassandra seeds in: $S3_CASSANDRA_NODES_DISCOVERY_URL"
+
+ startTime=$(date +%s)
+
+ while true; do
+ seeds=$(aws s3 ls $S3_CASSANDRA_NODES_DISCOVERY_URL | grep -v PRE | sed -r "s/^.* //g")
+ if [ -n "$seeds" ]; then
+ seeds=($seeds)
+ length=${#seeds[@]}
+
+ if [ $length -lt 4 ]; then
+ seed1=${seeds[0]}
+ seed2=${seeds[1]}
+ seed3=${seeds[2]}
+ else
+ pos1=$(($RANDOM%$length))
+ pos2=$(($RANDOM%$length))
+ pos3=$(($RANDOM%$length))
+ seed1=${seeds[${pos1}]}
+ seed2=${seeds[${pos2}]}
+ seed3=${seeds[${pos3}]}
+ fi
+
+ CASSANDRA_SEEDS="<value>$seed1<\/value>"
+
+ if [ "$seed2" != "$seed1" ] && [ -n "$seed2" ]; then
+ CASSANDRA_SEEDS="$CASSANDRA_SEEDS<value>$seed2<\/value>"
+ fi
+
+ if [ "$seed3" != "$seed2" ] && [ "$seed3" != "$seed1" ] && [ -n "$seed3" ]; then
+ CASSANDRA_SEEDS="$CASSANDRA_SEEDS<value>$seed3<\/value>"
+ fi
+
+ echo "[INFO] Using Cassandra seeds: $CASSANDRA_SEEDS"
+
+ cat /opt/ignite/config/ignite-cassandra-server-template.xml | sed -r "s/\\\$\{CASSANDRA_SEEDS\}/$CASSANDRA_SEEDS/g" > /opt/ignite/config/ignite-cassandra-server.xml
+
+ return 0
+ fi
+
+ currentTime=$(date +%s)
+ duration=$(( $currentTime-$startTime ))
+ duration=$(( $duration/60 ))
+
+ if [ $duration -gt $NODE_STARTUP_TIME ]; then
+ terminate "${NODE_STARTUP_TIME}min timeout expired, but no Cassandra nodes is up and running"
+ fi
+
+ echo "[INFO] Waiting for the first Cassandra node to start and publish its seed, time passed ${duration}min"
+
+ sleep 1m
+ done
+}
+
+setupIgniteSeeds()
+{
+ echo "[INFO] Setting up Ignite seeds"
+
+ if [ "$FIRST_NODE" == "true" ]; then
+ IGNITE_SEEDS="<value>127.0.0.1:47500..47509<\/value>"
+ echo "[INFO] Using localhost address as a seed for the first Ignite node: $IGNITE_SEEDS"
+ aws s3 rm --recursive ${S3_IGNITE_NODES_DISCOVERY_URL::-1}
+ if [ $? -ne 0 ]; then
+ terminate "Failed to clean Ignite node discovery URL: $S3_IGNITE_NODES_DISCOVERY_URL"
+ fi
+
+ cat /opt/ignite/config/ignite-cassandra-server.xml | sed -r "s/\\\$\{IGNITE_SEEDS\}/$IGNITE_SEEDS/g" > /opt/ignite/config/ignite-cassandra-server1.xml
+ mv -f /opt/ignite/config/ignite-cassandra-server1.xml /opt/ignite/config/ignite-cassandra-server.xml
+
+ return 0
+ fi
+
+ echo "[INFO] Looking for Ignite seeds in: $S3_IGNITE_NODES_DISCOVERY_URL"
+
+ startTime=$(date +%s)
+
+ while true; do
+ seeds=$(aws s3 ls $S3_IGNITE_NODES_DISCOVERY_URL | grep -v PRE | sed -r "s/^.* //g")
+ if [ -n "$seeds" ]; then
+ seeds=($seeds)
+ length=${#seeds[@]}
+
+ if [ $length -lt 4 ]; then
+ seed1=${seeds[0]}
+ seed2=${seeds[1]}
+ seed3=${seeds[2]}
+ else
+ pos1=$(($RANDOM%$length))
+ pos2=$(($RANDOM%$length))
+ pos3=$(($RANDOM%$length))
+ seed1=${seeds[${pos1}]}
+ seed2=${seeds[${pos2}]}
+ seed3=${seeds[${pos3}]}
+ fi
+
+ IGNITE_SEEDS="<value>$seed1<\/value>"
+
+ if [ "$seed2" != "$seed1" ] && [ -n "$seed2" ]; then
+ IGNITE_SEEDS="$IGNITE_SEEDS<value>$seed2<\/value>"
+ fi
+
+ if [ "$seed3" != "$seed2" ] && [ "$seed3" != "$seed1" ] && [ -n "$seed3" ]; then
+ IGNITE_SEEDS="$IGNITE_SEEDS<value>$seed3<\/value>"
+ fi
+
+ echo "[INFO] Using Ignite seeds: $IGNITE_SEEDS"
+
+ cat /opt/ignite/config/ignite-cassandra-server.xml | sed -r "s/\\\$\{IGNITE_SEEDS\}/$IGNITE_SEEDS/g" > /opt/ignite/config/ignite-cassandra-server1.xml
+ mv -f /opt/ignite/config/ignite-cassandra-server1.xml /opt/ignite/config/ignite-cassandra-server.xml
+
+ return 0
+ fi
+
+ currentTime=$(date +%s)
+ duration=$(( $currentTime-$startTime ))
+ duration=$(( $duration/60 ))
+
+ if [ $duration -gt $NODE_STARTUP_TIME ]; then
+ terminate "${NODE_STARTUP_TIME}min timeout expired, but no Ignite nodes is up and running"
+ fi
+
+ echo "[INFO] Waiting for the first Ignite node to start and publish its seed, time passed ${duration}min"
+
+ sleep 1m
+ done
+}
+
+tryToGetFirstNodeLock()
+{
+ echo "[INFO] Trying to get first node lock"
+
+ checkFirstNodeLockExist
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
+
+ createFirstNodeLock
+
+ sleep 5s
+
+ rm -Rf /opt/ignite/first-node-lock
+
+ aws s3 cp $S3_IGNITE_FIRST_NODE_LOCK_URL /opt/ignite/first-node-lock
+ if [ $? -ne 0 ]; then
+ echo "[WARN] Failed to check just created first node lock"
+ return 1
+ fi
+
+ first_host=$(cat /opt/ignite/first-node-lock)
+
+ rm -f /opt/ignite/first-node-lock
+
+ if [ "$first_host" != "$HOST_NAME" ]; then
+ echo "[INFO] Node $first_host has discarded previously created first node lock"
+ return 1
+ fi
+
+ echo "[INFO] Congratulations, got first node lock"
+
+ return 0
+}
+
+checkFirstNodeLockExist()
+{
+ echo "[INFO] Checking for the first node lock"
+
+ lockExists=$(aws s3 ls $S3_IGNITE_FIRST_NODE_LOCK_URL)
+ if [ -n "$lockExists" ]; then
+ echo "[INFO] First node lock already exists"
+ return 1
+ fi
+
+ echo "[INFO] First node lock doesn't exist yet"
+
+ return 0
+}
+
+createFirstNodeLock()
+{
+ aws s3 cp --sse AES256 /opt/ignite/join-lock $S3_IGNITE_FIRST_NODE_LOCK_URL
+ if [ $? -ne 0 ]; then
+ terminate "Failed to create first node lock"
+ fi
+ echo "[INFO] Created first node lock"
+}
+
+removeFirstNodeLock()
+{
+ aws s3 rm $S3_IGNITE_FIRST_NODE_LOCK_URL
+ if [ $? -ne 0 ]; then
+ terminate "Failed to remove first node lock"
+ fi
+ echo "[INFO] Removed first node lock"
+}
+
+tryToGetClusterJoinLock()
+{
+ echo "[INFO] Trying to get cluster join lock"
+
+ checkClusterJoinLockExist
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
+
+ createClusterJoinLock
+
+ sleep 5s
+
+ rm -Rf /opt/ignite/remote-join-lock
+
+ aws s3 cp $S3_IGNITE_NODES_JOIN_LOCK_URL /opt/ignite/remote-join-lock
+ if [ $? -ne 0 ]; then
+ echo "[WARN] Failed to check just created cluster join lock"
+ return 1
+ fi
+
+ join_host=$(cat /opt/ignite/remote-join-lock)
+
+ if [ "$join_host" != "$HOST_NAME" ]; then
+ echo "[INFO] Node $first_host has discarded previously created cluster join lock"
+ return 1
+ fi
+
+ echo "[INFO] Congratulations, got cluster join lock"
+
+ return 0
+}
+
+checkClusterJoinLockExist()
+{
+ echo "[INFO] Checking for the cluster join lock"
+
+ lockExists=$(aws s3 ls $S3_IGNITE_NODES_JOIN_LOCK_URL)
+ if [ -n "$lockExists" ]; then
+ echo "[INFO] Cluster join lock already exists"
+ return 1
+ fi
+
+ echo "[INFO] Cluster join lock doesn't exist"
+
+ return 0
+}
+
+createClusterJoinLock()
+{
+ aws s3 cp --sse AES256 /opt/ignite/join-lock $S3_IGNITE_NODES_JOIN_LOCK_URL
+ if [ $? -ne 0 ]; then
+ terminate "Failed to create cluster join lock"
+ fi
+ echo "[INFO] Created cluster join lock"
+}
+
+removeClusterJoinLock()
+{
+ aws s3 rm $S3_IGNITE_NODES_JOIN_LOCK_URL
+ if [ $? -ne 0 ]; then
+ terminate "Failed to remove cluster join lock"
+ fi
+ echo "[INFO] Removed cluster join lock"
+}
+
+waitToJoinIgniteCluster()
+{
+ echo "[INFO] Waiting to join Ignite cluster"
+
+ while true; do
+ tryToGetClusterJoinLock
+
+ if [ $? -ne 0 ]; then
+ echo "[INFO] Another node is trying to join cluster. Waiting for extra 1min."
+ sleep 1m
+ else
+ echo "[INFO]-------------------------------------------------------------"
+ echo "[INFO] Congratulations, got lock to join Ignite cluster"
+ echo "[INFO]-------------------------------------------------------------"
+ break
+ fi
+ done
+}
+
+checkIgniteStatus()
+{
+ proc=$(ps -ef | grep java | grep "org.apache.ignite.startup.cmdline.CommandLineStartup")
+
+ nodeId=
+ nodeAddrs=
+ nodePorts=
+ topology=
+ metrics=
+
+ logFile=$(ls /opt/ignite/work/log/ | grep "\.log$")
+ if [ -n "$logFile" ]; then
+ logFile=/opt/ignite/work/log/$logFile
+ nodeId=$(cat $logFile | grep "Local node \[ID")
+ nodeAddrs=$(cat $logFile | grep "Local node addresses:")
+ nodePorts=$(cat $logFile | grep "Local ports:")
+ topology=$(cat $logFile | grep "Topology snapshot")
+ metrics=$(cat $logFile | grep "Metrics for local node" | head -n 1)
+ fi
+
+ if [ -n "$nodeId" ] && [ -n "$nodeAddrs" ] && [ -n "$nodePorts" ] && [ -n "$topology" ] && [ -n "$metrics" ] && [ -n "$proc" ]; then
+ sleep 30s
+ return 0
+ fi
+
+ return 1
+}
+
+waitFirstIgniteNodeRegistered()
+{
+ echo "[INFO] Waiting for the first Ignite node to register"
+
+ startTime=$(date +%s)
+
+ while true; do
+ first_host=
+
+ exists=$(aws s3 ls $S3_IGNITE_FIRST_NODE_LOCK_URL)
+ if [ -n "$exists" ]; then
+ rm -Rf /opt/ignite/first-node-lock
+
+ aws s3 cp $S3_IGNITE_FIRST_NODE_LOCK_URL /opt/ignite/first-node-lock
+ if [ $? -ne 0 ]; then
+ terminate "Failed to check existing first node lock"
+ fi
+
+ first_host=$(cat /opt/ignite/first-node-lock)
+
+ rm -Rf /opt/ignite/first-node-lock
+ fi
+
+ if [ -n "$first_host" ]; then
+ exists=$(aws s3 ls ${S3_IGNITE_NODES_DISCOVERY_URL}${first_host})
+ if [ -n "$exists" ]; then
+ break
+ fi
+ fi
+
+ currentTime=$(date +%s)
+ duration=$(( $currentTime-$startTime ))
+ duration=$(( $duration/60 ))
+
+ if [ $duration -gt $NODE_STARTUP_TIME ]; then
+ terminate "${NODE_STARTUP_TIME}min timeout expired, but first Ignite node is still not up and running"
+ fi
+
+ echo "[INFO] Waiting extra 1min"
+
+ sleep 1m
+ done
+
+ echo "[INFO] First Ignite node registered"
+}
+
+startIgnite()
+{
+ echo "[INFO]-------------------------------------------------------------"
+ echo "[INFO] Trying attempt $START_ATTEMPT to start Ignite daemon"
+ echo "[INFO]-------------------------------------------------------------"
+ echo ""
+
+ setupCassandraSeeds
+ setupIgniteSeeds
+
+ if [ "$FIRST_NODE" == "true" ]; then
+ aws s3 rm --recursive ${S3_IGNITE_NODES_DISCOVERY_URL::-1}
+ if [ $? -ne 0 ]; then
+ terminate "Failed to clean Ignite node discovery URL: $S3_IGNITE_NODES_DISCOVERY_URL"
+ fi
+ else
+ waitToJoinIgniteCluster
+ fi
+
+ proc=$(ps -ef | grep java | grep "org.apache.ignite.startup.cmdline.CommandLineStartup")
+ proc=($proc)
+
+ if [ -n "${proc[1]}" ]; then
+ echo "[INFO] Terminating existing Ignite process ${proc[1]}"
+ kill -9 ${proc[1]}
+ fi
+
+ echo "[INFO] Starting Ignite"
+ rm -Rf /opt/ignite/work/*
+ /opt/ignite/bin/ignite.sh /opt/ignite/config/ignite-cassandra-server.xml &
+
+ echo "[INFO] Ignite job id: $!"
+
+ sleep 1m
+
+ START_ATTEMPT=$(( $START_ATTEMPT+1 ))
+}
+
+# Time (in minutes) to wait for Ignite/Cassandra daemon up and running
+NODE_STARTUP_TIME=10
+
+# Number of attempts to start (not first) Ignite daemon
+NODE_START_ATTEMPTS=3
+
+HOST_NAME=$(hostname -f | tr '[:upper:]' '[:lower:]')
+echo $HOST_NAME > /opt/ignite/join-lock
+
+START_ATTEMPT=0
+
+FIRST_NODE="false"
+
+unregisterNode
+
+tryToGetFirstNodeLock
+
+if [ $? -eq 0 ]; then
+ FIRST_NODE="true"
+fi
+
+echo "[INFO]-----------------------------------------------------------------"
+
+if [ "$FIRST_NODE" == "true" ]; then
+ echo "[INFO] Starting first Ignite node"
+else
+ echo "[INFO] Starting Ignite node"
+fi
+
+echo "[INFO]-----------------------------------------------------------------"
+echo "[INFO] Ignite nodes discovery URL: $S3_IGNITE_NODES_DISCOVERY_URL"
+echo "[INFO] Ignite first node lock URL: $S3_IGNITE_FIRST_NODE_LOCK_URL"
+echo "[INFO] Cassandra nodes discovery URL: $S3_CASSANDRA_NODES_DISCOVERY_URL"
+echo "[INFO] Start success URL: $S3_BOOTSTRAP_SUCCESS_URL"
+echo "[INFO] Start failure URL: $S3_BOOTSTRAP_FAILURE_URL"
+echo "[INFO] IGNITE_HOME: $IGNITE_HOME"
+echo "[INFO] JAVA_HOME: $JAVA_HOME"
+echo "[INFO] PATH: $PATH"
+echo "[INFO]-----------------------------------------------------------------"
+
+if [ -z "$S3_CASSANDRA_NODES_DISCOVERY_URL" ]; then
+ terminate "Cassandra S3 discovery URL doesn't specified"
+fi
+
+if [[ "$S3_CASSANDRA_NODES_DISCOVERY_URL" != */ ]]; then
+ S3_CASSANDRA_NODES_DISCOVERY_URL=${S3_CASSANDRA_NODES_DISCOVERY_URL}/
+fi
+
+if [ -z "$S3_IGNITE_NODES_DISCOVERY_URL" ]; then
+ terminate "Ignite S3 discovery URL doesn't specified"
+fi
+
+if [[ "$S3_IGNITE_NODES_DISCOVERY_URL" != */ ]]; then
+ S3_IGNITE_NODES_DISCOVERY_URL=${S3_IGNITE_NODES_DISCOVERY_URL}/
+fi
+
+if [ "$FIRST_NODE" != "true" ]; then
+ waitFirstIgniteNodeRegistered
+else
+ cleanupMetadata
+fi
+
+envScript=$(readlink -m $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/ignite-env.sh)
+if [ -f "$envScript" ]; then
+ . $envScript
+fi
+
+startIgnite
+
+startTime=$(date +%s)
+
+while true; do
+ proc=$(ps -ef | grep java | grep "org.apache.ignite.startup.cmdline.CommandLineStartup")
+
+ checkIgniteStatus
+
+ if [ $? -eq 0 ]; then
+ sleep 1m
+ echo "[INFO]-----------------------------------------------------"
+ echo "[INFO] Ignite daemon successfully started"
+ echo "[INFO]-----------------------------------------------------"
+ echo $proc
+ echo "[INFO]-----------------------------------------------------"
+
+ if [ "$FIRST_NODE" != "true" ]; then
+ removeClusterJoinLock
+ fi
+
+ break
+ fi
+
+ currentTime=$(date +%s)
+ duration=$(( $currentTime-$startTime ))
+ duration=$(( $duration/60 ))
+
+ if [ $duration -gt $NODE_STARTUP_TIME ]; then
+ if [ "$FIRST_NODE" == "true" ]; then
+ removeFirstNodeLock
+ terminate "${NODE_STARTUP_TIME}min timeout expired, but first Ignite daemon is still not up and running"
+ else
+ removeClusterJoinLock
+
+ if [ $START_ATTEMPT -gt $NODE_START_ATTEMPTS ]; then
+ terminate "${NODE_START_ATTEMPTS} attempts exceed, but Ignite daemon is still not up and running"
+ fi
+
+ startIgnite
+ fi
+
+ continue
+ fi
+
+ if [ -z "$proc" ]; then
+ if [ "$FIRST_NODE" == "true" ]; then
+ removeFirstNodeLock
+ terminate "Failed to start Ignite daemon"
+ fi
+
+ removeClusterJoinLock
+ echo "[WARN] Failed to start Ignite daemon. Sleeping for extra 1min"
+ sleep 1m
+ startIgnite
+ continue
+ fi
+
+ echo "[INFO] Waiting for Ignite daemon to start, time passed ${duration}min"
+ sleep 30s
+done
+
+registerNode
+
+terminate
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/83c26a91/modules/cassandra/src/test/bootstrap/aws/logs-collector.sh
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/bootstrap/aws/logs-collector.sh b/modules/cassandra/src/test/bootstrap/aws/logs-collector.sh
new file mode 100644
index 0000000..73e3c2c
--- /dev/null
+++ b/modules/cassandra/src/test/bootstrap/aws/logs-collector.sh
@@ -0,0 +1,102 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+echo "[INFO] Running Logs collector service"
+
+if [ -z "$1" ]; then
+ echo "[ERROR] Local logs directory doesn't specified"
+ exit 1
+fi
+
+echo "[INFO] Local logs directory: $1"
+
+if [ -z "$2" ]; then
+ echo "[ERROR] S3 folder where to upload logs doesn't specified"
+ exit 1
+fi
+
+echo "[INFO] S3 logs upload folder: $2"
+
+if [ -z "$3" ]; then
+ echo "[ERROR] Logs collection S3 trigger URL doesn't specified"
+ exit 1
+fi
+
+echo "[INFO] Logs collection S3 trigger URL: $3"
+
+echo "--------------------------------------------------------------------"
+
+TRIGGER_STATE=
+
+while true; do
+ sleep 1m
+
+ STATE=$(aws s3 ls $3)
+
+ if [ -z "$STATE" ] || [ "$STATE" == "$TRIGGER_STATE" ]; then
+ continue
+ fi
+
+ TRIGGER_STATE=$STATE
+
+ exists=
+ if [ -d "$1" ]; then
+ exists="true"
+ fi
+
+ echo "[INFO] Uploading logs from $1 to $2"
+
+ if [ "$exists" != "true" ]; then
+ echo "[INFO] Local logs directory $1 doesn't exist, thus there is nothing to upload"
+ fi
+
+ echo "--------------------------------------------------------------------"
+
+ if [ "$exists" != "true" ]; then
+ continue
+ fi
+
+ aws s3 sync --sse AES256 --delete "$1" "$2"
+
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to upload logs from $1 to $2 from first attempt"
+ sleep 30s
+
+ aws s3 sync --sse AES256 --delete "$1" "$2"
+
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to upload logs from $1 to $2 from second attempt"
+ sleep 1m
+
+ aws s3 sync --sse AES256 --delete "$1" "$2"
+
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to upload logs from $1 to $2 from third attempt"
+ else
+ echo "[INFO] Logs successfully uploaded from $1 to $2 from third attempt"
+ fi
+ else
+ echo "[INFO] Logs successfully uploaded from $1 to $2 from second attempt"
+ fi
+ else
+ echo "[INFO] Logs successfully uploaded from $1 to $2"
+ fi
+
+ echo "--------------------------------------------------------------------"
+done
http://git-wip-us.apache.org/repos/asf/ignite/blob/83c26a91/modules/cassandra/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml b/modules/cassandra/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml
new file mode 100644
index 0000000..53c33a2
--- /dev/null
+++ b/modules/cassandra/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd">
+
+ <bean id="loadBalancingPolicy" class="com.datastax.driver.core.policies.RoundRobinPolicy"/>
+
+ <util:list id="contactPoints" value-type="java.lang.String">
+ ${CASSANDRA_SEEDS}
+ </util:list>
+
+ <bean id="cassandraAdminDataSource" class="org.apache.ignite.cache.store.cassandra.datasource.DataSource">
+ <property name="user" value="cassandra"/>
+ <property name="password" value="cassandra"/>
+ <property name="contactPoints" ref="contactPoints"/>
+ <property name="readConsistency" value="ONE"/>
+ <property name="writeConsistency" value="ONE"/>
+ <property name="loadBalancingPolicy" ref="loadBalancingPolicy"/>
+ </bean>
+
+ <!-- Persistence settings for 'cache1' -->
+ <bean id="cache1_settings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
+ <constructor-arg type="java.lang.String">
+ <value><![CDATA[
+<persistence keyspace="test1" table="primitive_test1">
+ <keyPersistence class="java.lang.Long" strategy="PRIMITIVE" column="key"/>
+ <valuePersistence class="java.lang.Long" strategy="PRIMITIVE" column="value"/>
+</persistence>]]>
+ </value>
+ </constructor-arg>
+ </bean>
+
+ <!-- Persistence settings for 'cache2' -->
+ <bean id="cache2_settings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
+ <constructor-arg type="java.lang.String">
+ <value><![CDATA[
+<persistence keyspace="test1" table="blob_test1">
+ <keyPersistence class="java.lang.Long" strategy="PRIMITIVE" />
+ <valuePersistence strategy="BLOB"/>
+</persistence>]]>
+ </value>
+ </constructor-arg>
+ </bean>
+
+ <!-- Persistence settings for 'cache3' -->
+ <bean id="cache3_settings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
+ <constructor-arg type="java.lang.String">
+ <value><![CDATA[
+<persistence keyspace="test1" table="pojo_test3" ttl="86400">
+ <keyspaceOptions>
+ REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 3}
+ AND DURABLE_WRITES = true
+ </keyspaceOptions>
+ <tableOptions>
+ comment = 'A most excellent and useful table'
+ AND read_repair_chance = 0.2
+ </tableOptions>
+ <keyPersistence class="org.apache.ignite.tests.pojos.PersonId" strategy="POJO">
+ <partitionKey>
+ <field name="companyCode" column="company" />
+ <field name="departmentCode" column="department" />
+ </partitionKey>
+ <clusterKey>
+ <field name="personNumber" column="number" sort="desc"/>
+ </clusterKey>
+ </keyPersistence>
+ <valuePersistence class="org.apache.ignite.tests.pojos.Person"
+ strategy="POJO"
+ serializer="org.apache.ignite.cache.store.cassandra.serializer.KryoSerializer">
+ <field name="firstName" column="first_name" />
+ <field name="lastName" column="last_name" />
+ <field name="age" />
+ <field name="married" index="true"/>
+ <field name="height" />
+ <field name="weight" />
+ <field name="birthDate" column="birth_date" />
+ <field name="phones" />
+ </valuePersistence>
+</persistence>]]>
+ </value>
+ </constructor-arg>
+ </bean>
+
+ <!-- Ignite configuration -->
+ <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <!-- Turn on client mode -->
+ <property name="clientMode" value="true"/>
+
+ <property name="metricsLogFrequency" value="0"/>
+
+ <property name="cacheConfiguration">
+ <list>
+ <!-- Configuring persistence for "cache1" cache -->
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="cache1"/>
+ <property name="readThrough" value="true"/>
+ <property name="writeThrough" value="true"/>
+ <property name="writeBehindEnabled" value="true"/>
+ <property name="cacheStoreFactory">
+ <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
+ <property name="dataSourceBean" value="cassandraAdminDataSource"/>
+ <property name="persistenceSettingsBean" value="cache1_settings"/>
+ </bean>
+ </property>
+ </bean>
+
+ <!-- Configuring persistence for "cache2" cache -->
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="cache2"/>
+ <property name="readThrough" value="true"/>
+ <property name="writeThrough" value="true"/>
+ <property name="writeBehindEnabled" value="true"/>
+ <property name="cacheStoreFactory">
+ <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
+ <property name="dataSourceBean" value="cassandraAdminDataSource"/>
+ <property name="persistenceSettingsBean" value="cache2_settings"/>
+ </bean>
+ </property>
+ </bean>
+
+ <!-- Configuring persistence for "cache3" cache -->
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="cache3"/>
+ <property name="readThrough" value="true"/>
+ <property name="writeThrough" value="true"/>
+ <property name="writeBehindEnabled" value="true"/>
+ <property name="cacheStoreFactory">
+ <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
+ <property name="dataSourceBean" value="cassandraAdminDataSource"/>
+ <property name="persistenceSettingsBean" value="cache3_settings"/>
+ </bean>
+ </property>
+ </bean>
+ </list>
+ </property>
+
+ <!-- Configuring remote ignite cluster connections -->
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+ <property name="addresses">
+ <list>
+ ${IGNITE_SEEDS}
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/83c26a91/modules/cassandra/src/test/bootstrap/aws/tests/tests-bootstrap.sh
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/bootstrap/aws/tests/tests-bootstrap.sh b/modules/cassandra/src/test/bootstrap/aws/tests/tests-bootstrap.sh
new file mode 100644
index 0000000..d00ddb6
--- /dev/null
+++ b/modules/cassandra/src/test/bootstrap/aws/tests/tests-bootstrap.sh
@@ -0,0 +1,379 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+AWS_CLI_DOWNLOAD_URL=https://s3.amazonaws.com/aws-cli/awscli-bundle.zip
+
+S3_ROOT=s3://bucket/folder
+S3_DOWNLOADS=$S3_ROOT/test
+S3_SYSTEM=$S3_ROOT/test1
+
+TESTS_PACKAGE_DONLOAD_URL=$S3_DOWNLOADS/ignite-cassandra-tests-1.6.0-SNAPSHOT.zip
+TESTS_PACKAGE_ZIP=ignite-cassandra-tests-1.6.0-SNAPSHOT.zip
+TESTS_PACKAGE_UNZIP_DIR=ignite-cassandra-tests
+
+S3_LOGS_URL=$S3_SYSTEM/logs/t-logs
+S3_LOGS_TRIGGER_URL=$S3_SYSTEM/logs-trigger
+S3_IGNITE_NODES_DISCOVERY_URL=$S3_SYSTEM/i-discovery
+S3_CASSANDRA_NODES_DISCOVERY_URL=$S3_SYSTEM/c-discovery
+S3_TEST_NODES_DISCOVERY_URL=$S3_SYSTEM/t-discovery
+S3_TESTS_SUCCESS_URL=$S3_SYSTEM/t-success
+S3_TESTS_FAILURE_URL=$S3_SYSTEM/t-failure
+S3_TESTS_RUNNING_URL=$S3_SYSTEM/t-running
+S3_TESTS_WAITING_URL=$S3_SYSTEM/t-waiting
+S3_IGNITE_SUCCESS_URL=$S3_SYSTEM/i-success
+S3_IGNITE_FAILURE_URL=$S3_SYSTEM/i-failure
+S3_CASSANDRA_SUCCESS_URL=$S3_SYSTEM/c-success
+S3_CASSANDRA_FAILURE_URL=$S3_SYSTEM/c-failure
+S3_TESTS_FIRST_NODE_LOCK_URL=$S3_SYSTEM/t-first-node-lock
+S3_TESTS_SUMMARY_URL=$S3_SYSTEM/t-summary.zip
+
+INSTANCE_REGION=us-west-2
+INSTANCE_NAME_TAG=TEST-SERVER
+INSTANCE_OWNER_TAG=ignite@apache.org
+INSTANCE_PROJECT_TAG=ignite
+
+CASSANDRA_NODES_COUNT=50
+IGNITE_NODES_COUNT=30
+TEST_NODES_COUNT=30
+
+TESTS_TYPE="ignite"
+
+terminate()
+{
+ if [[ "$S3_TESTS_SUCCESS_URL" != */ ]]; then
+ S3_TESTS_SUCCESS_URL=${S3_TESTS_SUCCESS_URL}/
+ fi
+
+ if [[ "$S3_TESTS_FAILURE_URL" != */ ]]; then
+ S3_TESTS_FAILURE_URL=${S3_TESTS_FAILURE_URL}/
+ fi
+
+ host_name=$(hostname -f | tr '[:upper:]' '[:lower:]')
+ msg=$host_name
+
+ if [ -n "$1" ]; then
+ echo "[ERROR] $1"
+ echo "[ERROR]-----------------------------------------------------"
+ echo "[ERROR] Test node bootstrap failed"
+ echo "[ERROR]-----------------------------------------------------"
+ msg=$1
+ reportFolder=${S3_TESTS_FAILURE_URL}${host_name}
+ reportFile=$reportFolder/__error__
+ else
+ echo "[INFO]-----------------------------------------------------"
+ echo "[INFO] Test node bootstrap successfully completed"
+ echo "[INFO]-----------------------------------------------------"
+ reportFolder=${S3_TESTS_SUCCESS_URL}${host_name}
+ reportFile=$reportFolder/__success__
+ fi
+
+ echo $msg > /opt/bootstrap-result
+
+ aws s3 rm --recursive $reportFolder
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed drop report folder: $reportFolder"
+ fi
+
+ aws s3 cp --sse AES256 /opt/bootstrap-result $reportFile
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to report bootstrap result to: $reportFile"
+ fi
+
+ rm -f /opt/bootstrap-result
+
+ if [ -n "$1" ]; then
+ exit 1
+ fi
+
+ exit 0
+}
+
+tagInstance()
+{
+ export EC2_HOME=/opt/aws/apitools/ec2
+ export JAVA_HOME=/opt/jdk1.8.0_77
+ export PATH=$JAVA_HOME/bin:$EC2_HOME/bin:$PATH
+
+ INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
+ if [ $? -ne 0 ]; then
+ terminate "Failed to get instance metadata to tag it"
+ fi
+
+ if [ -n "$INSTANCE_NAME_TAG" ]; then
+ ec2-create-tags $INSTANCE_ID --tag Name=${INSTANCE_NAME_TAG} --region $INSTANCE_REGION
+ if [ $code -ne 0 ]; then
+ terminate "Failed to tag EC2 instance with: Name=${INSTANCE_NAME_TAG}"
+ fi
+ fi
+
+ if [ -n "$INSTANCE_OWNER_TAG" ]; then
+ ec2-create-tags $INSTANCE_ID --tag owner=${INSTANCE_OWNER_TAG} --region $INSTANCE_REGION
+ if [ $code -ne 0 ]; then
+ terminate "Failed to tag EC2 instance with: owner=${INSTANCE_OWNER_TAG}"
+ fi
+ fi
+
+ if [ -n "$INSTANCE_PROJECT_TAG" ]; then
+ ec2-create-tags $INSTANCE_ID --tag project=${INSTANCE_PROJECT_TAG} --region $INSTANCE_REGION
+ if [ $code -ne 0 ]; then
+ terminate "Failed to tag EC2 instance with: project=${INSTANCE_PROJECT_TAG}"
+ fi
+ fi
+}
+
+downloadPackage()
+{
+ echo "[INFO] Downloading $3 package from $1 into $2"
+
+ if [[ "$1" == s3* ]]; then
+ aws s3 cp $1 $2
+
+ if [ $? -ne 0 ]; then
+ echo "[WARN] Failed to download $3 package from first attempt"
+ rm -Rf $2
+ sleep 10s
+
+ echo "[INFO] Trying second attempt to download $3 package"
+ aws s3 cp $1 $2
+
+ if [ $? -ne 0 ]; then
+ echo "[WARN] Failed to download $3 package from second attempt"
+ rm -Rf $2
+ sleep 10s
+
+ echo "[INFO] Trying third attempt to download $3 package"
+ aws s3 cp $1 $2
+
+ if [ $? -ne 0 ]; then
+ terminate "All three attempts to download $3 package from $1 are failed"
+ fi
+ fi
+ fi
+ else
+ curl "$1" -o "$2"
+
+ if [ $? -ne 0 ] && [ $? -ne 6 ]; then
+ echo "[WARN] Failed to download $3 package from first attempt"
+ rm -Rf $2
+ sleep 10s
+
+ echo "[INFO] Trying second attempt to download $3 package"
+ curl "$1" -o "$2"
+
+ if [ $? -ne 0 ] && [ $? -ne 6 ]; then
+ echo "[WARN] Failed to download $3 package from second attempt"
+ rm -Rf $2
+ sleep 10s
+
+ echo "[INFO] Trying third attempt to download $3 package"
+ curl "$1" -o "$2"
+
+ if [ $? -ne 0 ] && [ $? -ne 6 ]; then
+ terminate "All three attempts to download $3 package from $1 are failed"
+ fi
+ fi
+ fi
+ fi
+
+ echo "[INFO] $3 package successfully downloaded from $1 into $2"
+}
+
+echo "[INFO]-----------------------------------------------------------------"
+echo "[INFO] Bootstrapping Tests node"
+echo "[INFO]-----------------------------------------------------------------"
+echo "[INFO] Tests type: $TESTS_TYPE"
+echo "[INFO] Test nodes count: $TEST_NODES_COUNT"
+echo "[INFO] Ignite nodes count: $IGNITE_NODES_COUNT"
+echo "[INFO] Cassandra nodes count: $CASSANDRA_NODES_COUNT"
+echo "[INFO] Tests summary URL: $S3_TESTS_SUMMARY_URL"
+echo "[INFO] Tests first node lock URL: $S3_TESTS_FIRST_NODE_LOCK_URL"
+echo "[INFO] Logs URL: $S3_LOGS_URL"
+echo "[INFO] Logs trigger URL: $S3_LOGS_TRIGGER_URL"
+echo "[INFO] Tests package download URL: $TESTS_PACKAGE_DONLOAD_URL"
+echo "[INFO] Test node discovery URL: $S3_TEST_NODES_DISCOVERY_URL"
+echo "[INFO] Ignite node discovery URL: $S3_IGNITE_NODES_DISCOVERY_URL"
+echo "[INFO] Cassandra node discovery URL: $S3_CASSANDRA_NODES_DISCOVERY_URL"
+echo "[INFO] Tests running URL: $S3_TESTS_RUNNING_URL"
+echo "[INFO] Tests waiting URL: $S3_TESTS_WAITING_URL"
+echo "[INFO] Tests success URL: $S3_TESTS_SUCCESS_URL"
+echo "[INFO] Tests failure URL: $S3_TESTS_FAILURE_URL"
+echo "[INFO] Ignite success URL: $S3_IGNITE_SUCCESS_URL"
+echo "[INFO] Ignite failure URL: $S3_IGNITE_FAILURE_URL"
+echo "[INFO] Cassandra success URL: $S3_CASSANDRA_SUCCESS_URL"
+echo "[INFO] Cassandra failure URL: $S3_CASSANDRA_FAILURE_URL"
+echo "[INFO]-----------------------------------------------------------------"
+
+echo "[INFO] Installing 'wget' package"
+yum -y install wget
+if [ $? -ne 0 ]; then
+ terminate "Failed to install 'wget' package"
+fi
+
+echo "[INFO] Installing 'net-tools' package"
+yum -y install net-tools
+if [ $? -ne 0 ]; then
+ terminate "Failed to install 'net-tools' package"
+fi
+
+echo "[INFO] Installing 'python' package"
+yum -y install python
+if [ $? -ne 0 ]; then
+ terminate "Failed to install 'python' package"
+fi
+
+echo "[INFO] Installing 'unzip' package"
+yum -y install unzip
+if [ $? -ne 0 ]; then
+ terminate "Failed to install 'unzip' package"
+fi
+
+rm -Rf /opt/jdk1.8.0_77 /opt/jdk-8u77-linux-x64.tar.gz
+
+echo "[INFO] Downloading 'jdk-8u77'"
+wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u77-b03/jdk-8u77-linux-x64.tar.gz" -O /opt/jdk-8u77-linux-x64.tar.gz
+if [ $? -ne 0 ]; then
+ terminate "Failed to download 'jdk-8u77'"
+fi
+
+echo "[INFO] Unzipping 'jdk-8u77'"
+tar -xvzf /opt/jdk-8u77-linux-x64.tar.gz -C /opt
+if [ $? -ne 0 ]; then
+ terminate "Failed to untar 'jdk-8u77'"
+fi
+
+rm -Rf /opt/jdk-8u77-linux-x64.tar.gz
+
+downloadPackage "https://bootstrap.pypa.io/get-pip.py" "/opt/get-pip.py" "get-pip.py"
+
+echo "[INFO] Installing 'pip'"
+python /opt/get-pip.py
+if [ $? -ne 0 ]; then
+ terminate "Failed to install 'pip'"
+fi
+
+echo "[INFO] Installing 'awscli'"
+pip install --upgrade awscli
+if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to install 'awscli' using pip"
+ echo "[INFO] Trying to install awscli using zip archive"
+ echo "[INFO] Downloading awscli zip"
+
+ downloadPackage "$AWS_CLI_DOWNLOAD_URL" "/opt/awscli-bundle.zip" "awscli"
+
+ echo "[INFO] Unzipping awscli zip"
+ unzip /opt/awscli-bundle.zip -d /opt
+ if [ $? -ne 0 ]; then
+ terminate "Failed to unzip awscli zip"
+ fi
+
+ rm -fR /opt/awscli-bundle.zip
+
+ echo "[INFO] Installing awscli"
+ /opt/awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
+ if [ $? -ne 0 ]; then
+ terminate "Failed to install awscli"
+ fi
+
+ echo "[INFO] Successfully installed awscli from zip archive"
+fi
+
+tagInstance
+
+echo "[INFO] Creating 'ignite' group"
+exists=$(cat /etc/group | grep ignite)
+if [ -z "$exists" ]; then
+ groupadd ignite
+ if [ $? -ne 0 ]; then
+ terminate "Failed to create 'ignite' group"
+ fi
+fi
+
+echo "[INFO] Creating 'ignite' user"
+exists=$(cat /etc/passwd | grep ignite)
+if [ -z "$exists" ]; then
+ useradd -g ignite ignite
+ if [ $? -ne 0 ]; then
+ terminate "Failed to create 'ignite' user"
+ fi
+fi
+
+downloadPackage "$TESTS_PACKAGE_DONLOAD_URL" "/opt/$TESTS_PACKAGE_ZIP" "Tests"
+
+unzip /opt/$TESTS_PACKAGE_ZIP -d /opt
+if [ $? -ne 0 ]; then
+ terminate "Failed to unzip tests package: $TESTS_PACKAGE_DONLOAD_URL"
+fi
+
+mv /opt/$TESTS_PACKAGE_UNZIP_DIR /opt/ignite-cassandra-tests
+
+if [ ! -f "/opt/ignite-cassandra-tests/cassandra-load-tests.sh" ]; then
+ terminate "There are no cassandra-load-tests.sh in tests package"
+fi
+
+if [ ! -f "/opt/ignite-cassandra-tests/ignite-load-tests.sh" ]; then
+ terminate "There are no ignite-load-tests.sh in tests package"
+fi
+
+if [ ! -f "/opt/ignite-cassandra-tests/bootstrap/aws/tests/ignite-cassandra-client-template.xml" ]; then
+ terminate "There are no ignite-cassandra-client-template.xml in tests package"
+fi
+
+if [ ! -f "/opt/$TESTS_PACKAGE_UNZIP_DIR/bootstrap/aws/logs-collector.sh" ]; then
+ terminate "There are no logs-collector.sh in tests package"
+fi
+
+chown -R ignite:ignite /opt/ignite-cassandra-tests
+find /opt/ignite-cassandra-tests -type f -name "*.sh" -exec chmod ug+x {} \;
+
+cp -f /opt/ignite-cassandra-tests/bootstrap/aws/logs-collector.sh /opt
+chown -R ignite:ignite /opt/logs-collector.sh
+
+#profile=/home/ignite/.bash_profile
+profile=/root/.bash_profile
+
+echo "export JAVA_HOME=/opt/jdk1.8.0_77" >> $profile
+echo "export PATH=\$JAVA_HOME/bin:\IGNITE_HOME/bin:\$PATH" >> $profile
+echo "export TESTS_TYPE=$TESTS_TYPE" >> $profile
+echo "export S3_TESTS_SUMMARY_URL=$S3_TESTS_SUMMARY_URL" >> $profile
+echo "export S3_CASSANDRA_NODES_DISCOVERY_URL=$S3_CASSANDRA_NODES_DISCOVERY_URL" >> $profile
+echo "export S3_TEST_NODES_DISCOVERY_URL=$S3_TEST_NODES_DISCOVERY_URL" >> $profile
+echo "export S3_IGNITE_NODES_DISCOVERY_URL=$S3_IGNITE_NODES_DISCOVERY_URL" >> $profile
+echo "export S3_TESTS_RUNNING_URL=$S3_TESTS_RUNNING_URL" >> $profile
+echo "export S3_TESTS_WAITING_URL=$S3_TESTS_WAITING_URL" >> $profile
+echo "export S3_TESTS_SUCCESS_URL=$S3_TESTS_SUCCESS_URL" >> $profile
+echo "export S3_TESTS_FAILURE_URL=$S3_TESTS_FAILURE_URL" >> $profile
+echo "export S3_IGNITE_SUCCESS_URL=$S3_IGNITE_SUCCESS_URL" >> $profile
+echo "export S3_IGNITE_FAILURE_URL=$S3_IGNITE_FAILURE_URL" >> $profile
+echo "export S3_CASSANDRA_SUCCESS_URL=$S3_CASSANDRA_SUCCESS_URL" >> $profile
+echo "export S3_CASSANDRA_FAILURE_URL=$S3_CASSANDRA_FAILURE_URL" >> $profile
+echo "export S3_TESTS_FIRST_NODE_LOCK_URL=$S3_TESTS_FIRST_NODE_LOCK_URL" >> $profile
+echo "export CASSANDRA_NODES_COUNT=$CASSANDRA_NODES_COUNT" >> $profile
+echo "export IGNITE_NODES_COUNT=$IGNITE_NODES_COUNT" >> $profile
+echo "export TEST_NODES_COUNT=$TEST_NODES_COUNT" >> $profile
+echo "export S3_LOGS_TRIGGER_URL=$S3_LOGS_TRIGGER_URL" >> $profile
+
+HOST_NAME=$(hostname -f | tr '[:upper:]' '[:lower:]')
+
+/opt/logs-collector.sh "/opt/ignite-cassandra-tests/logs" "$S3_LOGS_URL/$HOST_NAME" "$S3_LOGS_TRIGGER_URL" > /opt/ignite-cassandra-tests/logs-collector.log &
+
+cmd="/opt/ignite-cassandra-tests/bootstrap/aws/tests/tests-run.sh"
+
+#sudo -u ignite -g ignite sh -c "$cmd | tee /opt/ignite-cassandra-tests/start.log"
+
+$cmd | tee /opt/ignite-cassandra-tests/start.log
\ No newline at end of file