DolphinScheduler 3.1.0 本地环境搭建

环境准备

  • MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports)
  • Git
  • JDK: v1.8.x (Currently does not support jdk 11)
  • Maven: v3.5+
  • Node: v16.13+ (dolphinScheduler version is lower than 3.0, please install node v12.20+)
  • Pnpm: v6.x
  • Zookeeper: 3.8

1.克隆项目到本地

1
git clone https://github.com/apache/dolphinscheduler.git

2.导入项目到IDEA,并切换分支到3.1.0

1
git checkout 3.1.0-release

3.编译项目

spotless是一种代码格式化工具,使用 spotless:apply 表示格式化module代码

mvnw同mvn的功能是一样的,mvnw做了项目适配

1
2
./mvnw spotless:apply 
./mvnw clean install -Prelease -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dmaven.javadoc.skip=true

4.在mysql创建database数据库

1
CREATE SCHEMA dolphinschedulertest;

找到脚本dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql并运行

5.修改项目配置文件

全局搜索application.yaml,将文件中涉及postgresql的替换为mysql

1
2
3
4
5
6
7
8
9
10
#    driver-class-name: org.postgresql.Driver
# url: jdbc:postgresql://127.0.0.1:5432/dolphinscheduler
# username: root
# password: root
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/dolphinschedulertest
username: root
password: 123456

org.quartz.jobStore.driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate

6.修改dolphinscheduler-bom下pom.xml

1
2
3
4
5
6
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector.version}</version>
<scope>compile</scope>
</dependency>

7.修改logback-spring.xml

全局搜索logback-spring.xml,将下面内容添加到其中

1
2
3
4
<root level="INFO">
<!--将这句话加入到root节点下-->
<appender-ref ref="STDOUT"/>
</root>

8.配置启动项

分别配置MasterServer, WorkerServer, ApiApplicationServer

  • MasterServer:Execute function main in the class org.apache.dolphinscheduler.server.master.MasterServer by Intellij IDEA, with the configuration VM Options -Dlogging.config=classpath:logback-spring.xml -Ddruid.mysql.usePingMethod=false -Dspring.profiles.active=mysql
  • WorkerServer:Execute function main in the class org.apache.dolphinscheduler.server.worker.WorkerServer by Intellij IDEA, with the configuration VM Options -Dlogging.config=classpath:logback-spring.xml -Ddruid.mysql.usePingMethod=false -Dspring.profiles.active=mysql
  • ApiApplicationServer:Execute function main in the class org.apache.dolphinscheduler.api.ApiApplicationServer by Intellij IDEA, with the configuration VM Options -Dlogging.config=classpath:logback-spring.xml -Dspring.profiles.active=api,mysql. After it started, you could find Open API documentation in http://localhost:12345/dolphinscheduler/swagger-ui/index.html

9.配置zookeeper

参考以前的博客zookeeper部署

10.启动前端

1
2
pnpm install
pnpm run dev

11.启动后端

分别在IDEA中运行MasterServer, WorkerServer, ApiApplicationServer

登陆账号密码 admin/dolphinscheduler123

参考文档:https://www.bookstack.cn/read/dolphinscheduler-3.1.0-en/af18cd17a04eb31f.md

编译错误1:

1
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.1:pnpm (pnpm install) on project dolphinscheduler-ui: Failed to run task: 'pnpm install' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 9 (Exit value: 9) -> [Help 1]

解决办法:

修改dolphinscheduler-ui模块下的pom.xml,修改后记得重新执行./mvnw spotless:apply格式化代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!--                <plugins>-->
<!-- <plugin>-->
<!-- <groupId>com.github.eirslett</groupId>-->
<!-- <artifactId>frontend-maven-plugin</artifactId>-->
<!-- <version>${frontend-maven-plugin.version}</version>-->
<!-- <configuration>-->
<!-- <pnpmInheritsProxyConfigFromMaven>false</pnpmInheritsProxyConfigFromMaven>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>install node and pnpm</id>-->
<!-- <goals>-->
<!-- <goal>install-node-and-pnpm</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <nodeVersion>${node.version}</nodeVersion>-->
<!-- <pnpmVersion>${pnpm.version}</pnpmVersion>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- <execution>-->
<!-- <id>pnpm install</id>-->
<!-- <goals>-->
<!-- <goal>pnpm</goal>-->
<!-- </goals>-->
<!-- <phase>generate-resources</phase>-->
<!-- <configuration>-->
<!-- <arguments>install</arguments>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- <execution>-->
<!-- <id>pnpm run build:prod</id>-->
<!-- <goals>-->
<!-- <goal>pnpm</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <arguments>run build:prod</arguments>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- </plugins>-->