From b51c9995524486a294bf33b84326aa2da857ed08 Mon Sep 17 00:00:00 2001 From: dailidong Date: Mon, 18 May 2020 18:04:24 +0800 Subject: [PATCH] update worker group config (#2746) * fix worker group config no effect * remove codehaus janino jar the license about janino maybe not compatiable with Apache v2 * Merge remote-tracking branch 'upstream/dev-1.3.0' into dev-1.3.0 # Conflicts: # dolphinscheduler-server/src/main/resources/config/install_config.conf * Update datasource.properties --- dolphinscheduler-common/pom.xml | 6 ------ .../src/main/resources/datasource.properties | 3 +-- script/scp-hosts.sh | 18 +++++++++++++++--- script/start-all.sh | 13 ++++++++++++- script/stop-all.sh | 13 ++++++++++++- 5 files changed, 40 insertions(+), 13 deletions(-) diff --git a/dolphinscheduler-common/pom.xml b/dolphinscheduler-common/pom.xml index 3954159dfa..af1b2e4531 100644 --- a/dolphinscheduler-common/pom.xml +++ b/dolphinscheduler-common/pom.xml @@ -29,7 +29,6 @@ jar UTF-8 - 3.1.0 @@ -589,10 +588,5 @@ compile - - org.codehaus.janino - janino - ${codehaus.janino.version} - diff --git a/dolphinscheduler-dao/src/main/resources/datasource.properties b/dolphinscheduler-dao/src/main/resources/datasource.properties index 984aa17d57..25ac220312 100644 --- a/dolphinscheduler-dao/src/main/resources/datasource.properties +++ b/dolphinscheduler-dao/src/main/resources/datasource.properties @@ -21,7 +21,6 @@ spring.datasource.url=jdbc:postgresql://localhost:5432/dolphinscheduler spring.datasource.username=test spring.datasource.password=test -# mysql # connection configuration #spring.datasource.initialSize=5 # min connection number @@ -61,4 +60,4 @@ spring.datasource.password=test # open PSCache, specify count PSCache for every connection #spring.datasource.poolPreparedStatements=true -#spring.datasource.maxPoolPreparedStatementPerConnectionSize=20 \ No newline at end of file +#spring.datasource.maxPoolPreparedStatementPerConnectionSize=20 diff --git a/script/scp-hosts.sh b/script/scp-hosts.sh index 6e85566d4b..4a94cffa29 100644 --- a/script/scp-hosts.sh +++ b/script/scp-hosts.sh @@ -26,6 +26,18 @@ if [[ "$OSTYPE" == "darwin"* ]]; then txt="''" fi +declare -A workersGroupMap=() + +workersGroup=(${workers//,/ }) +for workerGroup in ${workersGroup[@]} +do + echo $workerGroup; + worker=`echo $workerGroup|awk -F':' '{print $1}'` + groupName=`echo $workerGroup|awk -F':' '{print $2}'` + workersGroupMap+=([$worker]=$groupName) +done + + hostsArr=(${ips//,/ }) for host in ${hostsArr[@]} do @@ -39,9 +51,9 @@ do for dsDir in bin conf lib script sql ui install.sh do - # if worker in workersGroup - if [[ "${workersGroup[${host}]}" ]] && [[ "${dsDir}" == "conf" ]]; then - sed -i ${txt} "s#worker.group.*#worker.group=${workersGroup[${host}]}#g" ${dsDir}/worker.properties + # if worker in workersGroupMap + if [[ "${workersGroupMap[${host}]}" ]] && [[ "${dsDir}" == "conf" ]]; then + sed -i ${txt} "s#worker.group.*#worker.group=${workersGroupMap[${host}]}#g" ${dsDir}/worker.properties fi echo "start to scp $dsDir to $host/$installPath" diff --git a/script/start-all.sh b/script/start-all.sh index dda46f0c06..61b916483e 100644 --- a/script/start-all.sh +++ b/script/start-all.sh @@ -20,6 +20,17 @@ workDir=`dirname $0` workDir=`cd ${workDir};pwd` source $workDir/../conf/config/install_config.conf +declare -A workersGroupMap=() + +workersGroup=(${workers//,/ }) +for workerGroup in ${workersGroup[@]} +do + echo $workerGroup; + worker=`echo $workerGroup|awk -F':' '{print $1}'` + groupName=`echo $workerGroup|awk -F':' '{print $2}'` + workersGroupMap+=([$worker]=$groupName) +done + mastersHost=(${masters//,/ }) for master in ${mastersHost[@]} do @@ -28,7 +39,7 @@ do done -for worker in ${!workersGroup[*]} +for worker in ${!workersGroupMap[*]} do echo "$worker worker server is starting" diff --git a/script/stop-all.sh b/script/stop-all.sh index e2afd087a9..dc18dae586 100644 --- a/script/stop-all.sh +++ b/script/stop-all.sh @@ -21,6 +21,17 @@ workDir=`cd ${workDir};pwd` source $workDir/../conf/config/install_config.conf +declare -A workersGroupMap=() + +workersGroup=(${workers//,/ }) +for workerGroup in ${workersGroup[@]} +do + echo $workerGroup; + worker=`echo $workerGroup|awk -F':' '{print $1}'` + groupName=`echo $workerGroup|awk -F':' '{print $2}'` + workersGroupMap+=([$worker]=$groupName) +done + mastersHost=(${masters//,/ }) for master in ${mastersHost[@]} do @@ -29,7 +40,7 @@ do done -for worker in ${!workersGroup[*]} +for worker in ${!workersGroupMap[*]} do echo "$worker worker server is stopping" ssh -p $sshPort $worker "cd $installPath/; sh bin/dolphinscheduler-daemon.sh stop worker-server;"