From b5f69f9ca44cdfe9c44c0b55deaccf8d3953f665 Mon Sep 17 00:00:00 2001 From: Mark Volmary Date: Fri, 9 Jun 2017 16:20:42 +0200 Subject: [PATCH] Add startLocalCluster.sh option --ongoing-ports --- scripts/cluster-run-common.sh | 5 +++++ scripts/shutdownLocalCluster.sh | 15 +++++++++++---- scripts/startLocalCluster.sh | 18 +++++++++++++----- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/scripts/cluster-run-common.sh b/scripts/cluster-run-common.sh index 51dcfd57a4..5410ee18f0 100644 --- a/scripts/cluster-run-common.sh +++ b/scripts/cluster-run-common.sh @@ -19,6 +19,7 @@ function help() { echo " -r/--rocksdb-engine Use Rocksdb engine (default: false )" echo " -q/--source-dir ArangoDB source dir (default: .)" echo " -B/--bin-dir ArangoDB binary dir (default: ./build)" + echo " -O/--ongoing-ports Ongoing ports (default: false)" echo "" echo "EXAMPLES:" echo " $0" @@ -114,6 +115,10 @@ while [[ ${1} ]]; do BUILD=${2} shift ;; + -O|--ongoing-ports) + ONGOING_PORTS=${2} + shift + ;; *) echo "Unknown parameter: ${1}" >&2 help diff --git a/scripts/shutdownLocalCluster.sh b/scripts/shutdownLocalCluster.sh index e6abd7f2be..c63c18324b 100755 --- a/scripts/shutdownLocalCluster.sh +++ b/scripts/shutdownLocalCluster.sh @@ -6,10 +6,17 @@ echo Number of Agents: $NRAGENTS echo Number of DBServers: $NRDBSERVERS echo Number of Coordinators: $NRCOORDINATORS -AG_BASE=$(( $PORT_OFFSET + 4001 )) -CO_BASE=$(( $PORT_OFFSET + 8530 )) -DB_BASE=$(( $PORT_OFFSET + 8629 )) -SE_BASE=$(( $PORT_OFFSET + 8729 )) +if [ -z "$ONGOING_PORTS" ] ; then + CO_BASE=$(( $PORT_OFFSET + 8530 )) + DB_BASE=$(( $PORT_OFFSET + 8629 )) + AG_BASE=$(( $PORT_OFFSET + 4001 )) + SE_BASE=$(( $PORT_OFFSET + 8729 )) +else + CO_BASE=$(( $PORT_OFFSET + 8530 )) + DB_BASE=$(( $PORT_OFFSET + 8530 + $NRCOORDINATORS )) + AG_BASE=$(( $PORT_OFFSET + 8530 + $NRCOORDINATORS + $NRDBSERVERS )) + SE_BASE=$(( $PORT_OFFSET + 8530 + $NRCOORDINATORS + $NRDBSERVERS + $NRAGENTS )) +fi LOCALHOST="[::1]" ANY="[::]" diff --git a/scripts/startLocalCluster.sh b/scripts/startLocalCluster.sh index 87cf426651..2282d6da70 100755 --- a/scripts/startLocalCluster.sh +++ b/scripts/startLocalCluster.sh @@ -28,9 +28,17 @@ fi SFRE=1.0 COMP=2000 KEEP=1000 -AG_BASE=$(( $PORT_OFFSET + 4001 )) -CO_BASE=$(( $PORT_OFFSET + 8530 )) -DB_BASE=$(( $PORT_OFFSET + 8629 )) +if [ -z "$ONGOING_PORTS" ] ; then + CO_BASE=$(( $PORT_OFFSET + 8530 )) + DB_BASE=$(( $PORT_OFFSET + 8629 )) + AG_BASE=$(( $PORT_OFFSET + 4001 )) + SE_BASE=$(( $PORT_OFFSET + 8729 )) +else + CO_BASE=$(( $PORT_OFFSET + 8530 )) + DB_BASE=$(( $PORT_OFFSET + 8530 + $NRCOORDINATORS )) + AG_BASE=$(( $PORT_OFFSET + 8530 + $NRCOORDINATORS + $NRDBSERVERS )) + SE_BASE=$(( $PORT_OFFSET + 8530 + $NRCOORDINATORS + $NRDBSERVERS + $NRAGENTS )) +fi NATH=$(( $NRDBSERVERS + $NRCOORDINATORS + $NRAGENTS )) ENDPOINT=[::] ADDRESS=[::1] @@ -183,8 +191,8 @@ done if [ "$SECONDARIES" == "1" ] ; then let index=1 - PORTTOPSE=`expr 8729 + $NRDBSERVERS - 1` - for PORT in `seq 8729 $PORTTOPSE` ; do + PORTTOPSE=`expr $SE_BASE + $NRDBSERVERS - 1` + for PORT in `seq $SE_BASE $PORTTOPSE` ; do mkdir cluster/data$PORT CLUSTER_ID="Secondary$index"