8000 enterprise scripts for agency · rexalways/arangodb@862355a · GitHub
[go: up one dir, main page]

Skip to content

Commit 862355a

Browse files
committed
enterprise scripts for agency
1 parent ce3d02e commit 862355a

File tree

1 file changed

+95
-53
lines changed

1 file changed

+95
-53
lines changed

scripts/startStandAloneAgency.sh

Lines changed: 95 additions & 53 deletions
14
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,131 @@
11
#!/bin/bash
22

3+
function help() {
4+
echo "USAGE: scripts/startStandAloneAgency.sh [options]"
5+
echo ""
6+
echo "OPTIONS:"
7+
echo " -a/--agency-size Agency size (odd integer default: 3))"
8+
echo " -p/--pool-size Pool size (>= agency size default: [agency size])"
9+
echo " -t/--transport Protocol (ssl|tcp default: tcp)"
10+
echo " -l/--log-level Log level (INFO|DEBUG|TRACE default: INFO)"
11+
echo ""
12+
echo "EXAMPLES:"
13+
echo " scripts/startStandaloneAgency.sh"
+
echo " scripts/startStandaloneAgency.sh -a 5 -p 10 -t ssl"
15+
echo " scripts/startStandaloneAgency.sh --agency-size 3 --pool-size 5"
16+
17+
}
18+
319
NRAGENTS=3
420
POOLSZ=""
521
TRANSPORT="tcp"
622
LOG_LEVEL="INFO"
723

8-
while getopts ":a:p:t:l:" opt; do
9-
case $opt in
10-
a) NRAGENTS="$OPTARG"
11-
;;
12-
p) POOLSZ="$OPTARG"
13-
;;
14-
t) TRANSPORT="$OPTARG"
15-
;;
16-
l) LOG_LEVEL="$OPTARG"
17-
;;
18-
\?) echo "Invalid option -$OPTARG" >&2
19-
;;
24+
while [[ ${1} ]]; do
25+
case "${1}" in
26+
-a|--agency-size)
27+
NRAGENTS=${2}
28+
shift
29+
;;
30+
-p|--pool-size)
31+
POOLSZ=${2}
32+
shift
33+
;;
34+
-t|--transport)
35+
TRANSPORT=${2}
36+
shift
37+
;;
38+
-l|--log-level)
39+
LOG_LEVEL=${2}
40+
shift
41+
;;
42+
-h|--help)
43+
help
44+
exit 1
45+
;;
46+
*)
47+
echo "Unknown parameter: ${1}" >&2
48+
help
49+
exit 1
50+
;;
2051
esac
52+
53+
if ! shift; then
54+
echo 'Missing parameter argument.' >&2
55+
return 1
56+
fi
2157
done
2258

2359
if [ "$POOLSZ" == "" ] ; then
24-
POOLSZ=$NRAGENTS
60+
POOLSZ=$NRAGENTS
2561
fi
2662

2763
if [ "$TRANSPORT" == "ssl" ]; then
28-
SSLKEYFILE="--ssl.keyfile UnitTests/server.pem"
64+
SSLKEYFILE="--ssl.keyfile UnitTests/server.pem"
65+
CURL="curl --insecure -ks https://"
2966
else
30-
SSLKEYFILE=""
67+
SSLKEYFILE=""
68+
CURL="curl -s http://"
3169
fi
3270

33-
printf "agency-size: %s\n" "$NRAGENTS"
34-
printf "pool-size: %s\n" "$POOLSZ"
35-
printf "transport: %s\n" "$TRANSPORT"
36-
printf "log-level: %s\n" "$LOG_LEVEL"
71+
printf "Starting agency ... \n"
72+
printf " agency-size: %s," "$NRAGENTS"
73+
printf " pool-size: %s," "$POOLSZ"
74+
printf " transport: %s," "$TRANSPORT"
75+
printf " log-level: %s\n" "$LOG_LEVEL"
3776

3877
if [ ! -d arangod ] || [ ! -d arangosh ] || [ ! -d UnitTests ] ; then
39-
echo Must be started in the main ArangoDB source directory.
40-
exit 1
78+
echo Must be started in the main ArangoDB source directory.
79+
exit 1
4180
fi
4281

4382
if [[ $(( $NRAGENTS % 2 )) == 0 ]]; then
44-
echo Number of agents must be odd.
45-
exit 1
83+
echo Number of agents must be odd.
84+
exit 1
4685
fi
4786

4887
MINP=0.5
4988
MAXP=2.0
5089
SFRE=2.5
5190
COMP=1000
52-
BASE=5001
91+
BASE=5000
5392

5493
rm -rf agency
5594
mkdir -p agency
56-
echo -n "Starting agency ... "
95+
PIDS=""
5796
for aid in `seq 0 $(( $POOLSZ - 1 ))`; do
58-
port=$(( $BASE + $aid ))
59-
build/bin/arangod \
60-
-c none \
61-
--agency.activate true \
62-
--agency.election-timeout-min $MINP \
63-
--agency.election-timeout-max $MAXP \
64-
--agency.endpoint $TRANSPORT://localhost:$BASE \
65-
--agency.my-address $TRANSPORT://localhost:$port \
66-
--agency.compaction-step-size $COMP \
67-
--agency.pool-size $POOLSZ \
68-
--agency.size $NRAGENTS \
69-
--agency.supervision true \
70-
--agency.supervision-frequency $SFRE \
71-
--agency.wait-for-sync false \
72-
--database.directory agency/data$port \
73-
--javascript.app-path ./js/apps \
74-
--javascript.startup-directory ./js \
75-
--javascript.v8-contexts 1 \
76-
--log.file agency/$port.log \
77-
--log.force-direct true \
78-
--log.level agency=$LOG_LEVEL \
79-
--server.authentication false \
80-
--server.endpoint $TRANSPORT://localhost:$port \
81-
--server.statistics false \
82-
$SSLKEYFILE \
83-
> agency/$port.stdout 2>&1 &
97+
port=$(( $BASE + $aid ))
98+
build/bin/arangod \
99+
-c none \
100+
--agency.activate true \
101+
--agency.election-timeout-min $MINP \
102+
--agency.election-timeout-max $MAXP \
103+
--agency.endpoint $TRANSPORT://localhost:$BASE \
104+
--agency.my-address $TRANSPORT://localhost:$port \
105+
--agency.compaction-step-size $COMP \
106+
--agency.pool-size $POOLSZ \
107+
--agency.size $NRAGENTS \
108+
--agency.supervision true \
109+
--agency.supervision-frequency $SFRE \
110+
--agency.wait-for-sync false \
111+
--database.directory agency/data$port \
112+
--javascript.app-path ./js/apps \
113+
--javascript.startup-directory ./js \
114+
--javascript.v8-contexts 1 \
115+
--log.file agency/$port.log \
116+
--log.force-direct true \
117+
--log.level agency=$LOG_LEVEL \
118+
--server.authentication false \
119+
--server.endpoint $TRANSPORT://localhost:$port \
120+
--server.statistics false \
121+
$SSLKEYFILE \
122+
> agency/$port.stdout 2>&1 &
123+
PIDS+=$!
124+
PIDS+=" "
84125
done
85126

86-
echo "done."
87-
echo "Your agents are ready at port $BASE onward"
127+
echo " done. Your agents are ready at port $BASE onward."
128+
#echo "Process ids: $PIDS"
129+
echo "Try ${CURL}localhost:5000/_api/agency/config."
88130

89131

0 commit comments

Comments
 (0)
0