-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcloud_restart_db_pre_benchmark_run.sh
executable file
·52 lines (42 loc) · 2.2 KB
/
gcloud_restart_db_pre_benchmark_run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Script to flush all memtables to disk, and restart the database before doing a database run
#
# Example usage (for cassandra) : ./gcloud_restart_db_pre_benchmark_run.sh msbench cassandra 3
# Example usage (for ScyllaDB): ./gcloud_restart_db_pre_benchmark_run.sh msbench scylla 3
PREFIX=$1
SUT=$2
CLUSTER_SIZE=$3
for ((i=1; i<=CLUSTER_SIZE; i++)); do echo "Running nodetool flush -- ycsb metrics on instance $i"; gcloud compute ssh $PREFIX-$SUT-cluster-$i --command='nodetool flush -- ycsb metrics'; done
for ((i=1; i<=CLUSTER_SIZE; i++)); do echo "nodetool status ycsb on $i"; gcloud compute ssh $PREFIX-$SUT-cluster-$i --command="nodetool status ycsb"; done
sleep 5
for ((i=1; i<=CLUSTER_SIZE; i++)); do
echo "Stopping $SUT on $i"
if [ "$SUT" = "scylla" ]; then
gcloud compute ssh $PREFIX-$SUT-cluster-$i --command="sudo systemctl stop scylla-server"
else
gcloud compute ssh $PREFIX-$SUT-cluster-$i --command="sudo systemctl stop $SUT"
fi
done
for ((i=1; i<=CLUSTER_SIZE; i++)); do echo "Clear page cache, dentries, and inodes on $i"; gcloud compute ssh $PREFIX-$SUT-cluster-$i --command="sudo free; sudo sync; echo 3 | sudo tee /proc/sys/vm/drop_caches; sudo free"; done
for ((i=1; i<=CLUSTER_SIZE; i++)); do
echo "Starting $SUT on $i"
if [ "$SUT" = "scylla" ]; then
gcloud compute ssh $PREFIX-$SUT-cluster-$i --command="sudo systemctl start scylla-server"
echo "Waiting 20 seconds after starting the Scylla DB server to give it some time to find itself..."
sleep 20
else
gcloud compute ssh $PREFIX-$SUT-cluster-$i --command="sudo systemctl start $SUT"
fi
done
sleep 5
for ((i=1; i<=CLUSTER_SIZE; i++)); do
echo "$SUT status on $i"
if [ "$SUT" = "scylla" ]; then
gcloud compute ssh $PREFIX-$SUT-cluster-$i --command="sudo systemctl status scylla-server"
else
gcloud compute ssh $PREFIX-$SUT-cluster-$i --command="sudo systemctl status $SUT"
fi
done
sleep 5
for ((i=1; i<=CLUSTER_SIZE; i++)); do echo "nodetool status ycsb on $i"; gcloud compute ssh $PREFIX-$SUT-cluster-$i --command="nodetool status ycsb"; done
for ((i=1; i<=CLUSTER_SIZE; i++)); do echo "nodetool compactionstats on $i"; gcloud compute ssh $PREFIX-$SUT-cluster-$i --command="nodetool compactionstats"; done