Browse Source

make combined server works in new dev-db branch (#1257)

pull/2/head
Baoqi Wu 5 years ago committed by qiaozhanwei
parent
commit
c8b0c1f105
  1. 6
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/CombinedApplicationServer.java
  2. 23
      dolphinscheduler-api/src/main/resources/application-combined.properties
  3. 15
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
  4. 3
      script/dolphinscheduler-daemon.sh

6
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/CombinedApplicationServer.java

@ -24,11 +24,13 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication @SpringBootApplication
@ServletComponentScan @ServletComponentScan
@ComponentScan("org.apache.dolphinscheduler") @ComponentScan("org.apache.dolphinscheduler")
@Import({MasterServer.class, WorkerServer.class})
@EnableSwagger2 @EnableSwagger2
public class CombinedApplicationServer extends SpringBootServletInitializer { public class CombinedApplicationServer extends SpringBootServletInitializer {
@ -36,10 +38,6 @@ public class CombinedApplicationServer extends SpringBootServletInitializer {
ApiApplicationServer.main(args); ApiApplicationServer.main(args);
MasterServer.main(args);
WorkerServer.main(args);
LoggerServer server = new LoggerServer(); LoggerServer server = new LoggerServer();
server.start(); server.start();

23
dolphinscheduler-api/src/main/resources/application-combined.properties

@ -0,0 +1,23 @@
logging.config=classpath:combined_logback.xml
# server port
server.port=12345
# session config
server.servlet.session.timeout=7200
server.servlet.context-path=/dolphinscheduler/
# file size limit for upload
spring.servlet.multipart.max-file-size=1024MB
spring.servlet.multipart.max-request-size=1024MB
#post content
server.jetty.max-http-post-size=5000000
spring.messages.encoding=UTF-8
#i18n classpath folder , file prefix messages, if have many files, use "," seperator
spring.messages.basename=i18n/messages
server.is-combined-server=true

15
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java

@ -42,6 +42,7 @@ import org.apache.dolphinscheduler.server.zk.ZKWorkerClient;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
@ -114,6 +115,12 @@ public class WorkerServer extends AbstractServer {
*/ */
private CountDownLatch latch; private CountDownLatch latch;
/**
* If inside combined server, WorkerServer no need to await on CountDownLatch
*/
@Value("${server.is-combined-server:false}")
private Boolean isCombinedServer;
/** /**
* master server startup * master server startup
* *
@ -196,9 +203,11 @@ public class WorkerServer extends AbstractServer {
//let the main thread await //let the main thread await
latch = new CountDownLatch(1); latch = new CountDownLatch(1);
try { if (!isCombinedServer) {
latch.await(); try {
} catch (InterruptedException ignore) { latch.await();
} catch (InterruptedException ignore) {
}
} }
} }

3
script/dolphinscheduler-daemon.sh

@ -54,6 +54,9 @@ elif [ "$command" = "alert-server" ]; then
CLASS=org.apache.dolphinscheduler.alert.AlertServer CLASS=org.apache.dolphinscheduler.alert.AlertServer
elif [ "$command" = "logger-server" ]; then elif [ "$command" = "logger-server" ]; then
CLASS=org.apache.dolphinscheduler.server.rpc.LoggerServer CLASS=org.apache.dolphinscheduler.server.rpc.LoggerServer
elif [ "$command" = "combined-server" ]; then
LOG_FILE="-Dspring.profiles.active=combined"
CLASS=org.apache.dolphinscheduler.api.CombinedApplicationServer
else else
echo "Error: No command named \`$command' was found." echo "Error: No command named \`$command' was found."
exit 1 exit 1

Loading…
Cancel
Save