You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2019/12/18 05:57:38 UTC

[GitHub] [incubator-dolphinscheduler] wenhemin opened a new issue #1509: [Feature] packaged and deployed

wenhemin opened a new issue #1509: [Feature] packaged and deployed
URL: https://github.com/apache/incubator-dolphinscheduler/issues/1509
 
 
   It is recommended that the project be packaged and deployed according the module. there are several issues problems with the current deployment method:
   
   1.Since all the released jar packages are together, when starting api、master and worker servers, many unrelated classes are also loaded. cause unnecessary memory consumption.
   `@ComponentScan("org.apache.dolphinscheduler")`
   
   2.The master server and worker server dose not need to listen on the port. error when removed.
   
   ----
   
   第二个问题的具体原因:
   master server启动时没有设置非web模式启动模式,由于所有jar包在一个目录,spring web相关jar包也会被加载,spring内部判断启动类型时会以是否加载web相关类为依据,所以会判断为web服务(默认启用8080端口),但是这个监听端口是无意义的
   ```
       public static void main(String[] args) {
           SpringApplication.run(MasterServer.class, args);
   //      new SpringApplicationBuilder(MasterServer.class).web(WebApplicationType.NONE).run(args);
       }
   ```
   如果将server启动改为被注释的那行代码,master服务启动后,druid组件会一直报“datasource already closed”,原因是web服务启动失败,spring会进行一个bean的回收处理,会关闭datasource。但是并没有停止MasterSchedulerThread这个线程,在循环查数据库(这应该也是个问题)
   
   web启动失败的原因是,api server模块中ServiceModelToSwagger2MapperImpl类依赖一些Mapper,Mapper的实现类在springfox.documentation.swagger2.mappers包中,加载这个包依赖这个注解@EnableSwagger2配置的包扫描路径,这个注解里面有@ConditionalOnWebApplication注解,只在web模式加载,以上原因导致spring找不到Mapper的依赖就启动失败了
   当前耦合的部署方式很容易导致一些隐蔽的问题
   ```
   @Configuration
   @Import({SpringfoxWebMvcConfiguration.class, SwaggerCommonConfiguration.class})
   @ComponentScan(
       basePackages = {"springfox.documentation.swagger2.mappers"}
   )
   @ConditionalOnWebApplication
   public class Swagger2DocumentationConfiguration {
   ```
   
   不好意思,英文实在是不好描述清楚

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services