9 until timeout 1s ssh $ssh_args ec2-user@$ip "exit" >/dev/null 2>&1
11 echo "retry connect rubbos vm ip $ip $retry"
14 if [[ $retry -ge $2 ]];then
15 echo "rubbos control start timeout !!!"
21 bottlenecks_prepare_env()
23 echo "Bottlenecks prepare env in VMs"
25 # configue rubbos control ssh key
28 # wait all other VMs ok
29 for i in $rubbos_benchmark $rubbos_client1 $rubbos_client2 \
30 $rubbos_client3 $rubbos_client4 $rubbos_httpd $rubbos_mysql1 $rubbos_tomcat1
35 # asynchronous configue other VMs
36 for i in $rubbos_benchmark $rubbos_client1 $rubbos_client2 \
37 $rubbos_client3 $rubbos_client4 $rubbos_httpd $rubbos_mysql1 $rubbos_tomcat1
39 scp $ssh_args -r $SCRIPT_DIR ec2-user@$i:$SCRIPT_DIR
40 ssh $ssh_args ec2-user@$i "sudo bash $SCRIPT_DIR/vm_prepare_setup.sh" &
43 # ugly use ssh execute script to fix ec2-user previlege issue
44 ssh $ssh_args ec2-user@$rubbos_control "sudo bash $SCRIPT_DIR/vm_prepare_setup.sh"
47 bottlenecks_download_repo()
49 echo "Bottlenecks: download bottlenecks repo"
51 if [ -d $BOTTELENECKS_REPO_DIR/.git ]; then
52 cd $BOTTLENECKS_REPO_DIR
53 sudo git pull origin master
54 if [ x"$GERRIT_REFSPEC_DEBUG" != x ]; then
55 sudo git fetch $BOTTLENECKS_REPO $GERRIT_REFSPEC_DEBUG && git checkout FETCH_HEAD
59 sudo rm -rf $BOTTLENECKS_REPO_DIR
60 sudo git clone $BOTTLENECKS_REPO $BOTTLENECKS_REPO_DIR
61 if [ x"$GERRIT_REFSPEC_DEBUG" != x ]; then
62 sudo git fetch $BOTTLENECKS_REPO $GERRIT_REFSPEC_DEBUG && git checkout FETCH_HEAD
68 bottlenecks_config_hosts_ip()
70 sed -i -e "s/REPLACE_CONTROL_HOST/$rubbos_control/g" \
71 -e "s/REPLACE_HTTPD_HOST/$rubbos_httpd/g" \
72 -e "s/REPLACE_MYSQL1_HOST/$rubbos_mysql1/g" \
73 -e "s/REPLACE_TOMCAT1_HOST/$rubbos_tomcat1/g" \
74 -e "s/REPLACE_CLIENT1_HOST/$rubbos_client1/g" \
75 -e "s/REPLACE_CLIENT2_HOST/$rubbos_client2/g" \
76 -e "s/REPLACE_CLIENT3_HOST/$rubbos_client3/g" \
77 -e "s/REPLACE_CLIENT4_HOST/$rubbos_client4/g" \
78 -e "s/REPLACE_BENCHMARK_HOST/$rubbos_benchmark/g" \
79 $BOTTELENECKS_REPO_DIR/rubbos/rubbos_scripts/1-1-1/set_bottlenecks_rubbos_env.sh
82 bottlenecks_download_packages()
84 echo "Bottlenecks: download rubbos dependent packages from artifacts"
86 curl --connect-timeout 10 -o /tmp/app_tools.tar.gz $RUBBOS_APP_TOOLS_URL 2>/dev/null
87 sudo tar zxvf /tmp/app_tools.tar.gz -C $RUBBOS_DIR
88 rm -rf /tmp/app_tools.tar.gz
89 curl --connect-timeout 10 -o /tmp/rubbosMulini6.tar.gz $RUBBOS_MULINI6_URL 2>/dev/null
90 sudo tar zxvf /tmp/rubbosMulini6.tar.gz -C $RUBBOS_MULINI6_DIR
91 rm -rf /tmp/rubbosMulini6.tar.gz
94 bottlenecks_rubbos_install_exe()
96 echo "Bottlenecks: install and run rubbos"
101 sudo ./CONTROL_rubbos_exec.sh
106 SCRIPT_DIR=`cd ${BASH_SOURCE[0]%/*};pwd`
108 ssh_args="-o StrictHostKeyChecking=no -o BatchMode=yes"
109 source $SCRIPT_DIR/package.conf
110 source $SCRIPT_DIR/hosts.conf
111 source $SCRIPT_DIR/common.sh
113 bottlenecks_prepare_env
114 bottlenecks_download_repo
115 bottlenecks_download_packages
116 bottlenecks_rubbos_install_exe