You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/05/24 15:12:11 UTC

[dolphinscheduler] 11/16: [Fix-10103][k8s]Fix k8s Change DataSource Error (#10128)

This is an automated email from the ASF dual-hosted git repository.

zhongjiajie pushed a commit to branch 3.0.0-beta-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git

commit 5d8679fba9ac5f03e60daff8e4c85b32fbd9aedc
Author: 旺阳 <qi...@cisco.com>
AuthorDate: Tue May 24 13:59:42 2022 +0800

    [Fix-10103][k8s]Fix k8s Change DataSource Error (#10128)
    
    (cherry picked from commit de5507fb1965fd993ed5e07f31f2167642c87130)
---
 dolphinscheduler-tools/src/main/bin/upgrade-schema.sh       |  6 ++----
 dolphinscheduler-tools/src/main/resources/application.yaml  |  9 ++++++++-
 dolphinscheduler-worker/src/main/resources/application.yaml | 10 ++++++++++
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/dolphinscheduler-tools/src/main/bin/upgrade-schema.sh b/dolphinscheduler-tools/src/main/bin/upgrade-schema.sh
index 355ebfe379..055157bc2b 100755
--- a/dolphinscheduler-tools/src/main/bin/upgrade-schema.sh
+++ b/dolphinscheduler-tools/src/main/bin/upgrade-schema.sh
@@ -19,13 +19,11 @@
 BIN_DIR=$(dirname $0)
 DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/../..; pwd)}
 
-if [ "$DOCKER" != "true" ]; then
-  source "$DOLPHINSCHEDULER_HOME/bin/env/dolphinscheduler_env.sh"
-fi
+source "$DOLPHINSCHEDULER_HOME/bin/env/dolphinscheduler_env.sh"
 
 JAVA_OPTS=${JAVA_OPTS:-"-server -Duser.timezone=${SPRING_JACKSON_TIME_ZONE} -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"}
 
 java $JAVA_OPTS \
   -cp "$DOLPHINSCHEDULER_HOME/tools/conf":"$DOLPHINSCHEDULER_HOME/tools/libs/*":"$DOLPHINSCHEDULER_HOME/tools/sql" \
-  -Dspring.profiles.active=upgrade \
+  -Dspring.profiles.active=upgrade,${DATABASE} \
   org.apache.dolphinscheduler.tools.datasource.UpgradeDolphinScheduler
diff --git a/dolphinscheduler-tools/src/main/resources/application.yaml b/dolphinscheduler-tools/src/main/resources/application.yaml
index 2c26aed0f3..45327b5848 100644
--- a/dolphinscheduler-tools/src/main/resources/application.yaml
+++ b/dolphinscheduler-tools/src/main/resources/application.yaml
@@ -43,4 +43,11 @@ spring:
       on-profile: mysql
   datasource:
     driver-class-name: com.mysql.jdbc.Driver
-    url: jdbc:mysql://127.0.0.1:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8
+
+---
+spring:
+  config:
+    activate:
+      on-profile: postgresql
+  datasource:
+    driver-class-name: org.postgresql.Driver
diff --git a/dolphinscheduler-worker/src/main/resources/application.yaml b/dolphinscheduler-worker/src/main/resources/application.yaml
index f0be99cef1..78965d237c 100644
--- a/dolphinscheduler-worker/src/main/resources/application.yaml
+++ b/dolphinscheduler-worker/src/main/resources/application.yaml
@@ -89,3 +89,13 @@ management:
 
 metrics:
   enabled: true
+
+# Override by profile
+
+---
+spring:
+  config:
+    activate:
+      on-profile: mysql
+  datasource:
+    driver-class-name: com.mysql.jdbc.Driver