1
0
Fork 0

Streamline shutdown and start

This commit is contained in:
Andreas Streichardt 2017-03-29 11:48:55 +02:00
parent a86abeae40
commit 0bf00036c6
3 changed files with 121 additions and 146 deletions

View File

@ -0,0 +1,116 @@
#!/bin/bash
function help() {
echo "USAGE: $0 [options]"
echo ""
echo "OPTIONS:"
echo " -a/--nagents # agents (odd integer default: 1))"
echo " -c/--ncoordinators # coordinators (odd integer default: 1))"
echo " -d/--ndbservers # db servers (odd integer default: 2))"
echo " -s/--secondaries Start secondaries (0|1 default: 0)"
echo " -t/--transport Protocol (ssl|tcp default: tcp)"
echo " -j/--jwt-secret JWT-Secret (string default: )"
echo " --log-level-agency Log level (agency) (string default: )"
echo " --log-level-cluster Log level (cluster) (string default: )"
echo " -i/--interactive Interactive mode (C|D|R default: '')"
echo " -x/--xterm XTerm command (default: xterm)"
echo " -o/--xterm-options XTerm options (default: --geometry=80x43)"
echo " -b/--offset-ports Offset ports (default: 0, i.e. A:4001, C:8530, D:8629)"
echo ""
echo "EXAMPLES:"
echo " $0"
echo " $0 -a 1 -c 1 -d 3 -t ssl"
echo " $0 -a 3 -c 1 -d 2 -t tcp -i C"
}
# defaults
NRAGENTS=1
NRDBSERVERS=2
NRCOORDINATORS=1
POOLSZ=""
TRANSPORT="tcp"
LOG_LEVEL="INFO"
LOG_LEVEL_AGENCY=""
LOG_LEVEL_CLUSTER=""
if [ -z "$XTERM" ] ; then
XTERM="x-terminal-emulator"
fi
if [ -z "$XTERMOPTIONS" ] ; then
XTERMOPTIONS="--geometry=80x43"
fi
SECONDARIES=0
BUILD="build"
JWT_SECRET=""
PORT_OFFSET=0
while [[ ${1} ]]; do
case "${1}" in
-a|--agency-size)
NRAGENTS=${2}
shift
;;
-c|--ncoordinators)
NRCOORDINATORS=${2}
shift
;;
-d|--ndbservers)
NRDBSERVERS=${2}
shift
;;
-s|--secondaries)
SECONDARIES=${2}
shift
;;
-t|--transport)
TRANSPORT=${2}
shift
;;
--log-level-agency)
LOG_LEVEL_AGENCY=${2}
shift
;;
--log-level-cluster)
LOG_LEVEL_CLUSTER=${2}
shift
;;
-i|--interactive)
INTERACTIVE_MODE=${2}
shift
;;
-j|--jwt-secret)
JWT_SECRET=${2}
shift
;;
-x|--xterm)
XTERM=${2}
shift
;;
-o|--xterm-options)
XTERMOPTIONS=${2}
shift
;;
-b|--port-offset)
PORT_OFFSET=${2}
shift
;;
-h|--help)
help
exit 1
;;
-B|--build)
BUILD=${2}
shift
;;
*)
echo "Unknown parameter: ${1}" >&2
help
exit 1
;;
esac
if ! shift; then
echo 'Missing parameter argument.' >&2
return 1
fi
done

View File

@ -1,39 +1,11 @@
#!/bin/bash
NRAGENTS=$1
if [ "$NRAGENTS" == "" ] ; then
NRAGENTS=1
fi
if [[ $(( $NRAGENTS % 2 )) == 0 ]]; then
echo Number of agents must be odd.
exit 1
fi
. `dirname $0`/cluster-run-common.sh
echo Number of Agents: $NRAGENTS
NRDBSERVERS=$2
if [ "$NRDBSERVERS" == "" ] ; then
NRDBSERVERS=2
fi
echo Number of DBServers: $NRDBSERVERS
NRCOORDINATORS=$3
if [ "$NRCOORDINATORS" == "" ] ; then
NRCOORDINATORS=1
fi
echo Number of Coordinators: $NRCOORDINATORS
if [ ! -z "$4" ] ; then
if [ "$4" == "C" ] ; then
COORDINATORCONSOLE=1
echo Starting one coordinator in terminal with --console
elif [ "$4" == "D" ] ; then
CLUSTERDEBUGGER=1
echo Running cluster in debugger.
elif [ "$4" == "R" ] ; then
RRDEBUGGER=1
echo Running cluster in rr with --console.
fi
fi
SECONDARIES="$5"
shutdown() {
PORT=$1
echo -n "$PORT "
@ -41,7 +13,7 @@ shutdown() {
echo
}
if [ -n "$SECONDARIES" ]; then
if [ "$SECONDARIES" == "1" ]; then
echo "Shutting down secondaries..."
PORTTOPSE=`expr 8729 + $NRDBSERVERS - 1`
for PORT in `seq 8729 $PORTTOPSE` ; do

View File

@ -1,119 +1,6 @@
#!/bin/bash
function help() {
echo "USAGE: scripts/startLocalCluster.sh [options]"
echo ""
echo "OPTIONS:"
echo " -a/--nagents # agents (odd integer default: 1))"
echo " -c/--ncoordinators # coordinators (odd integer default: 1))"
echo " -d/--ndbservers # db servers (odd integer default: 2))"
echo " -s/--secondaries Start secondaries (0|1 default: 0)"
echo " -t/--transport Protocol (ssl|tcp default: tcp)"
echo " -j/--jwt-secret JWT-Secret (string default: )"
echo " --log-level-agency Log level (agency) (string default: )"
echo " --log-level-cluster Log level (cluster) (string default: )"
echo " -i/--interactive Interactive mode (C|D|R default: '')"
echo " -x/--xterm XTerm command (default: xterm)"
echo " -o/--xterm-options XTerm options (default: --geometry=80x43)"
echo " -b/--offset-ports Offset ports (default: 0, i.e. A:4001, C:8530, D:8629)"
echo ""
echo "EXAMPLES:"
echo " scripts/startLocalCluster.sh"
echo " scripts/startLocalCluster.sh -a 1 -c 1 -d 3 -t ssl"
echo " scripts/startLocalCluster.sh -a 3 -c 1 -d 2 -t tcp -i C"
}
# defaults
NRAGENTS=1
NRDBSERVERS=2
NRCOORDINATORS=1
POOLSZ=""
TRANSPORT="tcp"
LOG_LEVEL="INFO"
LOG_LEVEL_AGENCY=""
LOG_LEVEL_CLUSTER=""
if [ -z "$XTERM" ] ; then
XTERM="x-terminal-emulator"
fi
if [ -z "$XTERMOPTIONS" ] ; then
XTERMOPTIONS="--geometry=80x43"
fi
SECONDARIES=0
BUILD="build"
JWT_SECRET=""
PORT_OFFSET=0
while [[ ${1} ]]; do
case "${1}" in
-a|--agency-size)
NRAGENTS=${2}
shift
;;
-c|--ncoordinators)
NRCOORDINATORS=${2}
shift
;;
-d|--ndbservers)
NRDBSERVERS=${2}
shift
;;
-s|--secondaries)
SECONDARIES=${2}
shift
;;
-t|--transport)
TRANSPORT=${2}
shift
;;
--log-level-agency)
LOG_LEVEL_AGENCY=${2}
shift
;;
--log-level-cluster)
LOG_LEVEL_CLUSTER=${2}
shift
;;
-i|--interactive)
INTERACTIVE_MODE=${2}
shift
;;
-j|--jwt-secret)
JWT_SECRET=${2}
shift
;;
-x|--xterm)
XTERM=${2}
shift
;;
-o|--xterm-options)
XTERMOPTIONS=${2}
shift
;;
-b|--port-offset)
PORT_OFFSET=${2}
shift
;;
-h|--help)
help
exit 1
;;
-B|--build)
BUILD=${2}
shift
;;
*)
echo "Unknown parameter: ${1}" >&2
help
exit 1
;;
esac
if ! shift; then
echo 'Missing parameter argument.' >&2
return 1
fi
done
. `dirname $0`/cluster-run-common.sh
if [ "$POOLSZ" == "" ] ; then
POOLSZ=$NRAGENTS