設計特點: 一個分佈式易擴展的可視化DAG工作流任務調度系統。致力於解決數據處理流程中錯綜複雜的依賴關係,使調度系統在數據處理流程中開箱即用
。 其主要目標如下:
- 以DAG圖的方式將Task按照任務的依賴關係關聯起來,可實時可視化監控任務的運行狀態
- 支持豐富的任務類型:Shell、MR、Spark、SQL(mysql、postgresql、hive、sparksql),Python,Sub_Process、Procedure等
- 支持工作流定時調度、依賴調度、手動調度、手動暫停/停止/恢復,同時支持失敗重試/告警、從指定節點恢復失敗、Kill任務等操作
- 支持工作流優先級、任務優先級及任務的故障轉移及任務超時告警/失敗
- 支持工作流全局參數及節點自定義參數設置
- 支持資源文件的在線上傳/下載,管理等,支持在線文件創建、編輯
- 支持任務日誌在線查看及滾動、在線下載日誌等
- 實現集羣HA,通過Zookeeper實現Master集羣和Worker集羣去中心化
- 支持對
Master/Worker
cpu load,memory,cpu在線查看 - 支持工作流運行歷史樹形/甘特圖展示、支持任務狀態統計、流程狀態統計
- 支持補數
- 支持多租戶
- 支持國際化
- 還有更多等待夥伴們探索
1.基礎環境
- PostgreSQL (8.2.15+) or Mysql (5.5+) : 兩者任選其一即可
- JDK (1.8+) : 必裝
- ZooKeeper (3.4.6+) :必裝
- Hadoop (2.6+) or MinIo :選裝, 如果需要使用到資源上傳功能,可以選擇Hadoop or MinIo
- Hive(1.2.1) : 選裝,hive任務提交需要安裝
- Spark (1.x,2.x) : 選裝,Spark任務提交需要安裝
2. 下載
git clone https://github.com/apache/incubator-dolphinscheduler.git -b 1.2.1.release
3.修改 pom.xml 文件 [採用 mysql 數據庫 ]
去掉mysql 中的 scope 依賴.
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.connector.version}</version>
<!--<scope>test</scope>-->
</dependency>
4.修改配置
4.1. apache-dolphinscheduler-1.2.1-src/dolphinscheduler-dao/src/main/resources/application.properties
# base spring data source configuration
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
# postgre
#spring.datasource.driver-class-name=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://localhost:5432/dolphinscheduler
# mysql
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8
spring.datasource.username=xxxx
spring.datasource.password=xxxx
4.2. apache-dolphinscheduler-1.2.1-src/dolphinscheduler-common/src/main/resources/quartz.properties
#============================================================================
# Configure Main Scheduler Properties
#============================================================================
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
org.quartz.dataSource.myDs.driver = com.mysql.jdbc.Driver
#org.quartz.dataSource.myDs.driver = org.postgresql.Driver
org.quartz.dataSource.myDs.URL = jdbc:mysql://localhost:3306/dolphinscheduler?characterEncoding=utf8
#org.quartz.dataSource.myDs.URL = jdbc:postgresql://localhost:5432/dolphinscheduler?characterEncoding=utf8
org.quartz.dataSource.myDs.user = xxxx
org.quartz.dataSource.myDs.password = xxxx
4.3./workspace/apache-dolphinscheduler-1.2.1-src/dolphinscheduler-common/src/main/resources/common.properties
#zookeeper cluster. multiple are separated by commas. eg. 192.168.xx.xx:2181,192.168.xx.xx:2181,192.168.xx.xx:2181
zookeeper.quorum=localhost:2181
5.編譯後端
進入項目根目錄,執行命令
mvn -U -X clean package -Prelease -Dmaven.test.skip=true
6.編譯前端
cd apache-dolphinscheduler-1.2.1-src/dolphinscheduler-ui
npm install node-sass --unsafe-perm
npm install [ 慢的話用這個 npm install --registry https://registry.npm.taobao.org]
修改配置
/workspace/apache-dolphinscheduler-1.2.1-src/dolphinscheduler-ui/.env
# back end interface address API_BASE = http://127.0.0.1:12345 # If IP access is required for local development, remove the "#" DEV_HOST = 127.0.0.1
啓動
npm run dev
7. 創建&初始化數據庫
創建數據庫
CREATE DATABASE escheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON escheduler.* TO '{user}'@'%' IDENTIFIED BY '{password}';
GRANT ALL PRIVILEGES ON escheduler.* TO '{user}'@'localhost' IDENTIFIED BY '{password}';
flush privileges;
運行
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/shell/CreateDolphinScheduler.java
8.導入項目到 idea
9.啓動類
運行:
org.apache.dolphinscheduler.server.master.MasterServer
org.apache.dolphinscheduler.server.worker.WorkerServer
org.apache.dolphinscheduler.api.CombinedApplicationServer
啓動CombinedApplicationServer的時候需要設置一下配置文件
10.觀看效果
admin/escheduler123
參考: