blob: e3b2108ff54d2dbddf59ad3111cda5e67a701653 [file] [log] [blame]
Masayoshi Kobayashif358ff52013-03-22 00:31:59 +00001#! /bin/bash
2USERNAME=ubuntu
3CASSANDRA_DIR='/home/ubuntu/apache-cassandra-1.1.4'
4ZK_DIR='/home/ubuntu/zookeeper-3.4.5'
5ZK_LIB='/var/lib/zookeeper'
6CASSANDRA_LIB='/var/lib/cassandra'
7
8SSH_COPY="authorized_keys id_rsa id_rsa.pub known_hosts onlab-gui.pem onlabkey.pem"
9
Masayoshi Kobayashi4de8d122013-04-08 19:19:47 +000010if [ x$ONOS_CLUSTER_BASENAME == "x" -o x$ONOS_CLUSTER_NR_NODES == "x" ]; then
11 echo "set environment variable ONOS_CLUSTER_BASENAME and ONOS_CLUSTER_NR_NODES"
Masayoshi Kobayashif358ff52013-03-22 00:31:59 +000012 exit
13fi
14
Masayoshi Kobayashi4de8d122013-04-08 19:19:47 +000015basename=$ONOS_CLUSTER_BASENAME
16NR_NODES=$ONOS_CLUSTER_NR_NODES
17
Masayoshi Kobayashif358ff52013-03-22 00:31:59 +000018dsh -g $basename 'uname -a'
19
20echo "Stopping Services"
21#dsh -g $basename 'cd ONOS; ./start-onos.sh stop'
22#dsh -g $basename 'cd ONOS; ./stop-cassandra stop'
23#dsh -g $basename '$ZK_DIR/bin/zkServer.sh stop'
24
25# authorized_keys cassandra.yaml hosts id_rsa id_rsa.pub known_hosts onlab-gui.pem onlabkey.pem onos.properties zoo.cfg
26## SSH Setting
27dsh -g $basename 'mkdir -m 700 .ssh'
28for n in $SSH_COPY; do
29 pcp -g $basename common/$n '.ssh'
30 if [ $n != "id_rsa.pub" ] ; then
31 dsh -g $basename "chmod 600 .ssh/$n"
32 fi
33done
34
35dsh -g $basename "sudo rm -rf $CASSANDRA_LIB/commitlog/*"
36dsh -g $basename "sudo rm -rf $CASSANDRA_LIB/saved_caches/*"
37dsh -g $basename "sudo rm -rf $CASSANDRA_LIB/data/*"
38dsh -g $basename "sudo chown -R $username:$username $CASSANDRA_LIB"
39
40dsh -g $basename "sudo rm -rf $ZK_LIB/version-2*"
41dsh -g $basename "sudo rm -rf $ZK_LIB/myid"
42
43pcp -g $basename common/cassandra.yaml $CASSANDRA_DIR/conf
44pcp -g $basename common/zoo.cfg $ZK_DIR/conf
45pcp -g $basename common/hosts '~'
46
47for n in `seq 1 $NR_NODES`; do
48 pcp -w ${basename}${n} ${basename}${n}/hostname '~'
49 pcp -w ${basename}${n} ${basename}${n}/myid $ZK_DIR/conf
50done
51
52dsh -g $basename 'sudo cp ~/hostname /etc'
53dsh -g $basename 'sudo cp ~/hosts /etc'
54dsh -g $basename "cd $ZK_LIB; sudo ln -s $ZK_DIR/conf/myid"
55
56dsh -g $basename 'sudo hostname `cat /etc/hostname`'
57
Masayoshi Kobayashi4de8d122013-04-08 19:19:47 +000058#for n in `seq 2 $NR_NODES`; do
59# pcp -w ${basename}${n} ${basename}${n}/onsdemo_edge.py 'ONOS/test-network/mininet'
60# pcp -w ${basename}${n} ${basename}${n}/tunnel_onos_edge.sh 'ONOS/test-network/mininet'
61#done
62#pcp -w ${basename}1 ${basename}1/tunnel_onos_core.sh 'ONOS/test-network/mininet'
63#pcp -w ${basename}1 ${basename}1/onsdemo_core.py 'ONOS/test-network/mininet'