From 5cc82c5900867471f083b8c0c4519d83d66310e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=94=E6=96=B9=E4=B8=8D=E5=9C=A8=E6=89=8B?= <39549317+wenhemin@users.noreply.github.com> Date: Tue, 24 Dec 2019 22:11:11 +0800 Subject: [PATCH] =?UTF-8?q?remove=20master=20server=20and=20worker=20serve?= =?UTF-8?q?r=20listening=20port=20(5566=E3=80=817788)=20(#1551)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix:When there are multiple nodes, the monitoring center dashboard displays only one node. * fix:Catching exceptions and printing exception information * fix:rollback * fix:getting project name field bug * fix: remove master server and worker server listening port (5566、7788) --- .../apache/dolphinscheduler/api/ApiApplicationServer.java | 1 - .../api/configuration/ServiceModelToSwagger2MapperImpl.java | 3 ++- .../dolphinscheduler/api/configuration/SwaggerConfig.java | 2 ++ .../apache/dolphinscheduler/server/master/MasterServer.java | 5 +++-- .../apache/dolphinscheduler/server/worker/WorkerServer.java | 5 +++-- .../src/main/resources/application-master.properties | 5 +---- .../src/main/resources/application-worker.properties | 3 --- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java index ccf787d706..8376c2876d 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java @@ -26,7 +26,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @SpringBootApplication @ServletComponentScan @ComponentScan("org.apache.dolphinscheduler") -@EnableSwagger2 public class ApiApplicationServer extends SpringBootServletInitializer { public static void main(String[] args) { diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ServiceModelToSwagger2MapperImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ServiceModelToSwagger2MapperImpl.java index d454b8d312..90d820910a 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ServiceModelToSwagger2MapperImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ServiceModelToSwagger2MapperImpl.java @@ -16,12 +16,12 @@ */ package org.apache.dolphinscheduler.api.configuration; -import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; import io.swagger.models.*; import io.swagger.models.parameters.Parameter; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Primary; import org.springframework.context.i18n.LocaleContextHolder; @@ -41,6 +41,7 @@ import static com.google.common.collect.Maps.newTreeMap; */ @Component(value = "ServiceModelToSwagger2Mapper") @Primary +@ConditionalOnWebApplication public class ServiceModelToSwagger2MapperImpl extends ServiceModelToSwagger2Mapper { diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/SwaggerConfig.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/SwaggerConfig.java index 6240e7d924..346f8f1a18 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/SwaggerConfig.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/SwaggerConfig.java @@ -17,6 +17,7 @@ package org.apache.dolphinscheduler.api.configuration; import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI; +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -37,6 +38,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration @EnableSwagger2 @EnableSwaggerBootstrapUI +@ConditionalOnWebApplication public class SwaggerConfig implements WebMvcConfigurer { @Bean 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 b10f248484..621b8839b0 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 @@ -35,6 +35,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.context.annotation.ComponentScan; import javax.annotation.PostConstruct; @@ -95,8 +97,7 @@ public class MasterServer implements IStoppable { * @param args arguments */ public static void main(String[] args) { - SpringApplication.run(MasterServer.class, args); - + new SpringApplicationBuilder(MasterServer.class).web(WebApplicationType.NONE).run(args); } /** 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 32dea48a4e..be12b2f80e 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 @@ -42,7 +42,8 @@ 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.SpringApplication; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.context.annotation.ComponentScan; import javax.annotation.PostConstruct; @@ -127,7 +128,7 @@ public class WorkerServer implements IStoppable { * @param args arguments */ public static void main(String[] args) { - SpringApplication.run(WorkerServer.class,args); + new SpringApplicationBuilder(WorkerServer.class).web(WebApplicationType.NONE).run(args); } diff --git a/dolphinscheduler-server/src/main/resources/application-master.properties b/dolphinscheduler-server/src/main/resources/application-master.properties index 9f157cda37..49d28e810f 100644 --- a/dolphinscheduler-server/src/main/resources/application-master.properties +++ b/dolphinscheduler-server/src/main/resources/application-master.properties @@ -15,7 +15,4 @@ # limitations under the License. # -logging.config=classpath:master_logback.xml - -# server port -server.port=5566 +logging.config=classpath:master_logback.xml \ No newline at end of file diff --git a/dolphinscheduler-server/src/main/resources/application-worker.properties b/dolphinscheduler-server/src/main/resources/application-worker.properties index 54dddf59c9..be4319d204 100644 --- a/dolphinscheduler-server/src/main/resources/application-worker.properties +++ b/dolphinscheduler-server/src/main/resources/application-worker.properties @@ -16,6 +16,3 @@ # logging.config=classpath:worker_logback.xml - -# server port -server.port=7788