-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslave-start.sh
executable file
·74 lines (54 loc) · 2.02 KB
/
slave-start.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
create_config_file() {
read -ep "Enter IP Address of the host running cosbench_ng slave: " HOST_IP_ADDR
read -ep "Enter an unused port number on this host: " HOST_PORT_NO
echo "All your details are being saved in file .cosbench_ng"
echo >> .cosbench_ng
chmod +x .cosbench_ng
echo "#New Slave Configuration: `date`" >> .cosbench_ng
echo "export HOST_IP_ADDR=$HOST_IP_ADDR" >> .cosbench_ng
echo "export HOST_PORT_NO=$HOST_PORT_NO" >> .cosbench_ng
}
print_help() {
echo "First $0 --configure to configure your environment"
echo "then $0 --help to see help instructions for cosbench_ng slave"
}
if [ $# -eq 0 ]; then
print_help
exit 1
elif [ "$1" == "--configure" ]; then
create_config_file
exit 0
elif [ ! -f ./.cosbench_ng ]; then
print_help
exit 1
fi
. ./.cosbench_ng
if [ -z ${HOST_IP_ADDR} ]; then
echo "HOST_IP_ADDR needs to be set";
echo "run: $0 --configure to configure your environment first"
exit 1
else
echo "Using HOST_IP_ADDR: $HOST_IP_ADDR";
fi
if [ -z ${HOST_PORT_NO} ]; then
echo "HOST_PORT_NO needs to be set";
echo "run: $0 --configure to configure your environment first"
exit 1
else
echo "Using HOST_PORT_NO: $HOST_PORT_NO";
fi
echo "WARNING: Slave cannot run on the same host as the master... (due to issues with how UDP works with docker containers)"
# loop forever only if it is a real command
if [ "$1" == "--help" ]; then
docker run --shm-size 1G -v /tmp:/tmp -e HOST_PORT_NO -e HOST_IP_ADDR -p ${HOST_PORT_NO}:${HOST_PORT_NO}/udp vardhanv/cosbench_ng-slave:0.9 "$@"
else
while true
do
# -Daeron.* are to reduce aeron memory footprint so we can deploy more slaves. Not required if the host machines have more RAM
docker run --shm-size 2g -v /tmp:/tmp -e HOST_PORT_NO -e HOST_IP_ADDR -p ${HOST_PORT_NO}:${HOST_PORT_NO}/udp vardhanv/cosbench_ng-slave:0.9 -Daeron.ipc.term.buffer.length=33554432 -Daeron.term.buffer.length=8388608 "$@"
sleep 5
done
fi