- français
- English
Azure Scripts
# create_vm.sh create vm from supervisor image:
HOSTNAME=$1
azure vm create --userName azureuser --password ****** --location "West Europe" --vm-size "Basic_A2" --vm-name $HOSTNAME --ssh 22 --virtual-network-name stormcluster --subnet-names "Subnet-2" $HOSTNAME.cloudapp.net storm-supervisor-a2-ubuntu
MACHINE=$HOSTNAME.cloudapp.net
ssh-copy-id azureuser@$MACHINE
scp reload-storm.sh azureuser@$MACHINE:/home/azureuser/
ssh azureuser@$MACHINE /home/azureuser/reload-storm.sh $HOSTNAME
# reload-storm.sh
sudo rm -rf /app/storm
sudo mkdir -p /app/storm
sudo chown -R storm:storm /app/storm
sudo chmod 750 /app/storm
HOSTNAME=$1
echo $HOSTNAME
sudo sed -i "s/storm.local.hostname: \".*\"/storm.local.hostname: \"${HOSTNAME}\"/g" /opt/storm/conf/storm.yaml
sudo service supervisor stop
sudo service supervisor start
# attach_disk.sh
VM=$1
HOSTNAME=$VM
if [ $HOSTNAME == "nimbus1" ]; then
HOSTNAME="efnimbus1"
fi
DATA=$2 # example tpch1
azure vm disk create --os Linux -u https://epflbigdata2015.blob.core.windows.net/vhds/$VM-$DATA.vhd $VM-$DATA-disk https://epflbigdata2015.blob.core.windows.net/vhds/$DATA.vhd
azure vm disk attach -c ReadOnly $VM $VM-$DATA-disk
ssh azureuser@$HOSTNAME.cloudapp.net 'sudo mount /dev/sdc1 /data'
# detach_disk.sh:
HOSTNAME=$1
DATA=$2 # example tpch1
azure vm disk detach -b $HOSTNAME 0 # assume the disk is the first attached disk
# all_actions.sh : apply actions on all machines, for example: ./all_actions.sh 3 "azure vm start" host
supervisor_count=$1
script=$2
arg_string=$3
#echo $arg_string
args=(${arg_string})
#IFS=' ' read -a args <<< "$arg_string"
data="tpch1"
declare -a hosts=("nimbus1" "zookeeper1")
for i in $(seq 1 $supervisor_count)
do
hosts+=("supervisor$i")
done
for host in "${hosts[@]}"
do
echo "$host"
command="$script "
for i in "${args[@]}"
do
command+=${!i}
command+=" "
done
echo "$command"
eval "$command"
done