文檔編寫目的:
記錄從0-1搭建DolphinScheduler開發環境的過程(Windows)
DolphinScheduler官網地址:https://dolphinscheduler.apache.org/zh-cn/
安裝zookeeper
下載鏈接:
https://www.apache.org/dyn/closer.lua/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
[root@node2 soft]# ls zookeeper-3.4.14 zookeeper-3.4.14.tar.gz
在conf目錄下新建zoo_sample.cfg文件的的副本,並將副本改名為zoo.cfg
[root@node2 soft]# cd zookeeper-3.4.14 [root@node2 zookeeper-3.4.14]# [root@node2 zookeeper-3.4.14]# [root@node2 zookeeper-3.4.14]# ll total 1672 drwxr-xr-x 2 2002 2002 223 Jun 29 11:22 bin -rw-rw-r-- 1 2002 2002 97426 Mar 7 2019 build.xml drwxr-xr-x 2 2002 2002 92 Jun 29 11:22 conf drwxr-xr-x 2 2002 2002 4096 Mar 7 2019 dist-maven -rw-rw-r-- 1 2002 2002 1709 Mar 7 2019 ivysettings.xml -rw-rw-r-- 1 2002 2002 10742 Mar 7 2019 ivy.xml drwxr-xr-x 4 2002 2002 308 Mar 7 2019 lib -rw-rw-r-- 1 2002 2002 11970 Mar 7 2019 LICENSE.txt -rw-rw-r-- 1 2002 2002 3132 Mar 7 2019 NOTICE.txt -rw-rw-r-- 1 2002 2002 31622 Mar 7 2019 pom.xml -rw-rw-r-- 1 2002 2002 1765 Mar 7 2019 README.md -rw-rw-r-- 1 2002 2002 1770 Mar 7 2019 README_packaging.txt drwxr-xr-x 3 2002 2002 22 Mar 7 2019 src -rw-rw-r-- 1 2002 2002 1515359 Mar 7 2019 zookeeper-3.4.14.jar -rw-rw-r-- 1 2002 2002 836 Mar 7 2019 zookeeper-3.4.14.jar.asc -rw-rw-r-- 1 2002 2002 33 Mar 7 2019 zookeeper-3.4.14.jar.md5 -rw-rw-r-- 1 2002 2002 41 Mar 7 2019 zookeeper-3.4.14.jar.sha1 drwxr-xr-x 3 2002 2002 47 Mar 7 2019 zookeeper-client drwxr-xr-x 12 2002 2002 4096 Mar 7 2019 zookeeper-contrib drwxr-xr-x 7 2002 2002 4096 Mar 7 2019 zookeeper-docs drwxr-xr-x 3 2002 2002 35 Mar 7 2019 zookeeper-it drwxr-xr-x 4 2002 2002 46 Mar 7 2019 zookeeper-jute drwxr-xr-x 5 2002 2002 176 Mar 7 2019 zookeeper-recipes drwxr-xr-x 3 2002 2002 32 Mar 7 2019 zookeeper-server [root@node2 zookeeper-3.4.14]# [root@node2 zookeeper-3.4.14]# cd conf/ [root@node2 conf]# [root@node2 conf]# ll total 16 -rw-rw-r-- 1 2002 2002 535 Mar 7 2019 configuration.xsl -rw-rw-r-- 1 2002 2002 2161 Mar 7 2019 log4j.properties -rw-r--r-- 1 root root 941 Jun 29 11:22 zoo.cfg -rw-rw-r-- 1 2002 2002 922 Mar 7 2019 zoo_sample.cfg
本地啟zk需要注意下 zk的數據目錄
[root@node2 conf]# cat zoo_sample.cfg # The number of milliseconds of each tick tickTime=2000 # The number of ticks that the initial # synchronization phase can take initLimit=10 # The number of ticks that can pass between # sending a request and getting an acknowledgement syncLimit=5 # the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes. #dataDir=/tmp/zookeeper dataDir=/opt/soft/zookeeperdata/zookeeper # the port at which the clients will connect clientPort=2181 # the maximum number of client connections. # increase this if you need to handle more clients #maxClientCnxns=60 # # Be sure to read the maintenance section of the # administrator guide before turning on autopurge. # # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance # # The number of snapshots to retain in dataDir #autopurge.snapRetainCount=3 # Purge task interval in hours # Set to "0" to disable auto purge feature #autopurge.purgeInterval=1
啟動zookeeper
# 啟動zk
./zkServer.sh start
# 停止zk
./zkServer.sh stop
[root@node2 bin]# ll total 88 -rwxr-xr-x 1 2002 2002 232 Mar 7 2019 README.txt -rwxr-xr-x 1 2002 2002 1937 Mar 7 2019 zkCleanup.sh -rwxr-xr-x 1 2002 2002 1056 Mar 7 2019 zkCli.cmd -rwxr-xr-x 1 2002 2002 1534 Mar 7 2019 zkCli.sh -rwxr-xr-x 1 2002 2002 1759 Mar 7 2019 zkEnv.cmd -rwxr-xr-x 1 2002 2002 2919 Mar 7 2019 zkEnv.sh -rwxr-xr-x 1 2002 2002 1089 Mar 7 2019 zkServer.cmd -rwxr-xr-x 1 2002 2002 6773 Mar 7 2019 zkServer.sh -rwxr-xr-x 1 2002 2002 996 Mar 7 2019 zkTxnLogToolkit.cmd -rwxr-xr-x 1 2002 2002 1385 Mar 7 2019 zkTxnLogToolkit.sh -rw-r--r-- 1 root root 41931 Jun 30 15:28 zookeeper.out
zk安裝完成
[root@node2 bin]# netstat -tunlp | grep 2181 tcp 0 0 :::2181 :::* LISTEN 26788/java
獲取代碼
git clone https://github.com/apache/incubator-dolphinscheduler.git
后端開發環境搭建
導入idea,刷下maven,執行源碼編譯命令,在pom中注釋掉ui模塊
執行編譯命令
mvn -U clean package -Prelease -Dmaven.test.skip=true
在apiserver啟動類上指定配置文件
@PropertySource(ignoreResourceNotFound = false, value = "classpath:application-api.properties")
去除pom中的mysql的scope
配置dao模塊中的數據庫連接信息
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://192.168.x.xxx:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8 spring.datasource.username=dolphinscheduler spring.datasource.password=dolphinscheduler
配置zk連接信息
指定各模塊的配置文件
@PropertySource(ignoreResourceNotFound = false, value = "classpath:master.properties")
master.properties
@PropertySource(ignoreResourceNotFound = false, value = "classpath:worker.properties")
worker.properties
在worker-server啟動的vm option中添加日志配置,否則會出現task instance的log path為空,導致本地調試不正常
-Dspring.profiles.active=worker -Dlogging.config="dolphinscheduler-server/src/main/resources/logback-worker.xml"
啟動三個服務 api master worker, 正常啟動表明后端開發環境搭建完成
前端開發環境搭建
運行npm install
初始化數據庫
在mysql中執行數據庫創建命令
CREATE DATABASE dolphinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; CREATE USER 'dscheduler'@'%' IDENTIFIED BY 'dscheduler'; GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'dscheduler'@'%' IDENTIFIED BY 'dscheduler'; flush privileges;
執行dao模塊下的CreateDolphinScheduler
數據庫創建成功
啟動前后端服務
在idea中啟動 api master worker
修改前端項目中的.env文件
運行npm run start啟動前端頁面
訪問http://localhost:8888/
采用管理員賬戶admin dolphinscheduler123進行登陸,出現頁面即整個項目的頁面,則開發環境搭建完成
end