You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ki...@apache.org on 2021/12/03 13:06:51 UTC
[dolphinscheduler] branch 2.0.1-prepare updated: Fix quartz not work, worker / alert server should not listen or 8080 port (#7159)
This is an automated email from the ASF dual-hosted git repository.
kirs pushed a commit to branch 2.0.1-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/2.0.1-prepare by this push:
new 449c098 Fix quartz not work, worker / alert server should not listen or 8080 port (#7159)
449c098 is described below
commit 449c098aef3c7881518147d5e32e98aa3f64e1b7
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Fri Dec 3 21:06:08 2021 +0800
Fix quartz not work, worker / alert server should not listen or 8080 port (#7159)
---
.../apache/dolphinscheduler/alert/AlertServer.java | 6 +-
.../apache/dolphinscheduler/common/Constants.java | 5 --
.../server/master/MasterServer.java | 9 +++
.../server/worker/WorkerServer.java | 2 +
.../service/quartz/QuartzExecutors.java | 70 ++++++++++------------
install.sh | 4 +-
script/dolphinscheduler-daemon.sh | 2 +
script/remove-zk-node.sh | 2 +
script/scp-hosts.sh | 2 +
script/start-all.sh | 3 +
script/status-all.sh | 2 +
script/stop-all.sh | 2 +
12 files changed, 65 insertions(+), 44 deletions(-)
diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java
index b3dfa62..d549ec9 100644
--- a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java
+++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java
@@ -38,7 +38,9 @@ import javax.annotation.PreDestroy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
+import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ComponentScan;
@EnableAutoConfiguration
@@ -66,7 +68,9 @@ public class AlertServer implements Closeable {
}
public static void main(String[] args) {
- SpringApplication.run(AlertServer.class, args);
+ new SpringApplicationBuilder(AlertServer.class)
+ .web(WebApplicationType.NONE)
+ .run(args);
}
@PostConstruct
diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
index d403572..7f97c9c 100644
--- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
+++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
@@ -453,11 +453,6 @@ public final class Constants {
*/
public static final String DEFAULT_CRON_STRING = "0 0 0 * * ? *";
-
- /**
- * data source config
- */
-
public static final String SPRING_DATASOURCE_DRIVER_CLASS_NAME = "spring.datasource.driver-class-name";
public static final String SPRING_DATASOURCE_URL = "spring.datasource.url";
diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java
index 176e796..ce0a080 100644
--- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java
+++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java
@@ -20,6 +20,7 @@ package org.apache.dolphinscheduler.server.master;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.IStoppable;
import org.apache.dolphinscheduler.common.thread.Stopper;
+import org.apache.dolphinscheduler.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.remote.NettyRemotingServer;
import org.apache.dolphinscheduler.remote.command.CommandType;
import org.apache.dolphinscheduler.remote.config.NettyServerConfig;
@@ -43,12 +44,15 @@ import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.transaction.annotation.EnableTransactionManagement;
+import static org.apache.dolphinscheduler.common.Constants.SPRING_DATASOURCE_DRIVER_CLASS_NAME;
+
/**
* master server
*/
@@ -101,6 +105,9 @@ public class MasterServer implements IStoppable {
@Autowired
private EventExecuteService eventExecuteService;
+ @Value("${spring.datasource.driver-class-name}")
+ private String driverClassName;
+
private ConcurrentHashMap<Integer, WorkflowExecuteThread> processInstanceExecMaps = new ConcurrentHashMap<>();
/**
@@ -118,6 +125,8 @@ public class MasterServer implements IStoppable {
*/
@PostConstruct
public void run() {
+ PropertyUtils.setValue(SPRING_DATASOURCE_DRIVER_CLASS_NAME, driverClassName);
+
// init remoting server
NettyServerConfig serverConfig = new NettyServerConfig();
serverConfig.setListenPort(masterConfig.getListenPort());
diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
index 64120f3..0cf8088 100644
--- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
+++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
@@ -35,6 +35,7 @@ import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
@@ -108,6 +109,7 @@ public class WorkerServer implements IStoppable {
public static void main(String[] args) {
Thread.currentThread().setName(Constants.THREAD_NAME_WORKER_SERVER);
new SpringApplicationBuilder(WorkerServer.class)
+ .web(WebApplicationType.NONE)
.profiles("worker")
.run(args);
}
diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
index 9f49dd7..622206a 100644
--- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
+++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
@@ -17,6 +17,39 @@
package org.apache.dolphinscheduler.service.quartz;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.lang.StringUtils;
+import org.apache.dolphinscheduler.common.utils.DateUtils;
+import org.apache.dolphinscheduler.common.utils.JSONUtils;
+import org.apache.dolphinscheduler.common.utils.PropertyUtils;
+import org.apache.dolphinscheduler.dao.entity.Schedule;
+import org.apache.dolphinscheduler.service.exceptions.ServiceException;
+import org.quartz.CronTrigger;
+import org.quartz.Job;
+import org.quartz.JobDetail;
+import org.quartz.JobKey;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.TriggerKey;
+import org.quartz.impl.StdSchedulerFactory;
+import org.quartz.impl.jdbcjobstore.JobStoreTX;
+import org.quartz.impl.jdbcjobstore.PostgreSQLDelegate;
+import org.quartz.impl.jdbcjobstore.StdJDBCDelegate;
+import org.quartz.impl.matchers.GroupMatcher;
+import org.quartz.simpl.SimpleThreadPool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import static org.apache.dolphinscheduler.common.Constants.ORG_POSTGRESQL_DRIVER;
import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS;
import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_ACQUIRETRIGGERSWITHINLOCK;
@@ -54,47 +87,10 @@ import static org.apache.dolphinscheduler.common.Constants.SPRING_DATASOURCE_DRI
import static org.apache.dolphinscheduler.common.Constants.STRING_FALSE;
import static org.apache.dolphinscheduler.common.Constants.STRING_TRUE;
import static org.apache.dolphinscheduler.common.Constants.UNDERLINE;
-
import static org.quartz.CronScheduleBuilder.cronSchedule;
import static org.quartz.JobBuilder.newJob;
import static org.quartz.TriggerBuilder.newTrigger;
-import org.apache.dolphinscheduler.common.utils.DateUtils;
-import org.apache.dolphinscheduler.common.utils.JSONUtils;
-import org.apache.dolphinscheduler.common.utils.PropertyUtils;
-import org.apache.dolphinscheduler.dao.entity.Schedule;
-import org.apache.dolphinscheduler.service.exceptions.ServiceException;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.commons.lang.StringUtils;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import org.quartz.CronTrigger;
-import org.quartz.Job;
-import org.quartz.JobDetail;
-import org.quartz.JobKey;
-import org.quartz.Scheduler;
-import org.quartz.SchedulerException;
-import org.quartz.TriggerKey;
-import org.quartz.impl.StdSchedulerFactory;
-import org.quartz.impl.jdbcjobstore.JobStoreTX;
-import org.quartz.impl.jdbcjobstore.PostgreSQLDelegate;
-import org.quartz.impl.jdbcjobstore.StdJDBCDelegate;
-import org.quartz.impl.matchers.GroupMatcher;
-import org.quartz.simpl.SimpleThreadPool;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* single Quartz executors instance
*/
diff --git a/install.sh b/install.sh
index a0cd9e4..57441e6 100755
--- a/install.sh
+++ b/install.sh
@@ -19,7 +19,9 @@
workDir=`dirname $0`
workDir=`cd ${workDir};pwd`
+set -a
source ${workDir}/conf/config/install_config.conf
+set +a
# 1.replace file
echo "1.replace file"
@@ -31,7 +33,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
fi
datasourceDriverClassname="com.mysql.jdbc.Driver"
-if [ $dbtype == "postgresql" ];then
+if [[ $dbtype == "postgresql" ]];then
datasourceDriverClassname="org.postgresql.Driver"
fi
diff --git a/script/dolphinscheduler-daemon.sh b/script/dolphinscheduler-daemon.sh
index 036bfd1..19f8373 100755
--- a/script/dolphinscheduler-daemon.sh
+++ b/script/dolphinscheduler-daemon.sh
@@ -36,8 +36,10 @@ BIN_DIR=`cd "$BIN_DIR"; pwd`
DOLPHINSCHEDULER_HOME=`cd "$BIN_DIR/.."; pwd`
source /etc/profile
+set -a
source "${DOLPHINSCHEDULER_HOME}/conf/env/dolphinscheduler_env.sh"
source "${DOLPHINSCHEDULER_HOME}/conf/config/install_config.conf"
+set +a
export HOSTNAME=`hostname`
diff --git a/script/remove-zk-node.sh b/script/remove-zk-node.sh
index 2cb8a2b..d6a2171 100755
--- a/script/remove-zk-node.sh
+++ b/script/remove-zk-node.sh
@@ -31,8 +31,10 @@ BIN_DIR=`dirname $0`
BIN_DIR=`cd "$BIN_DIR"; pwd`
DOLPHINSCHEDULER_HOME=$BIN_DIR/..
+set -a
source ${BIN_DIR}/../conf/config/install_config.conf
source ${BIN_DIR}/../conf/env/dolphinscheduler_env.sh
+set +a
export JAVA_HOME=$JAVA_HOME
diff --git a/script/scp-hosts.sh b/script/scp-hosts.sh
index da08446..161436c 100755
--- a/script/scp-hosts.sh
+++ b/script/scp-hosts.sh
@@ -18,7 +18,9 @@
workDir=`dirname $0`
workDir=`cd ${workDir};pwd`
+set -a
source $workDir/../conf/config/install_config.conf
+set +a
txt=""
if [[ "$OSTYPE" == "darwin"* ]]; then
diff --git a/script/start-all.sh b/script/start-all.sh
index d0c0ab8..b024d6c 100755
--- a/script/start-all.sh
+++ b/script/start-all.sh
@@ -18,7 +18,10 @@
workDir=`dirname $0`
workDir=`cd ${workDir};pwd`
+
+set -a
source $workDir/../conf/config/install_config.conf
+set +a
declare -A workersGroupMap=()
diff --git a/script/status-all.sh b/script/status-all.sh
index 555a2c1..24cdb75 100755
--- a/script/status-all.sh
+++ b/script/status-all.sh
@@ -18,7 +18,9 @@
workDir=`dirname $0`
workDir=`cd ${workDir};pwd`
+set -a
source $workDir/../conf/config/install_config.conf
+set +a
# install_config.conf info
echo -e '\n'
diff --git a/script/stop-all.sh b/script/stop-all.sh
index 20175e9..884f1d9 100755
--- a/script/stop-all.sh
+++ b/script/stop-all.sh
@@ -19,7 +19,9 @@
workDir=`dirname $0`
workDir=`cd ${workDir};pwd`
+set -a
source $workDir/../conf/config/install_config.conf
+set +a
declare -A workersGroupMap=()