Panduan Anda untuk Mendapatkan Apache Dolphinscheduler Berlari Secara Lokal (tanpa Breaking Stuff)

Artikel ini secara sistematis menguraikan proses umum untuk menyiapkan lingkungan debugging lokal untuk Apache Dolphinscheduler di Ide, termasuk persiapan lingkungan, konfigurasi kode, startup layanan, dan langkah -langkah inti lainnya untuk referensi.

1. Persiapan Komponen Dasar

1. JDK: v1.8.x (currently does not support JDK 11)  
2. Maven: v3.5+  
3. Node.js: v18.19.1+, install pnpm  
// Global installation  
npm install pnpm -g  
// Check registry  
pnpm config get registry  
// Switch to Taobao registry  
pnpm config set registry https://registry.npmmirror.com/  

4. Zookeeper: 3.6.3 (this version is used by big data platforms, DS reuses the platform's Zookeeper). When using the latest DS, it uses curator 5.3.0  
Curator 5.0 supports Zookeeper 3.6.X, no longer supports Zookeeper 3.4.X  
Curator 4.X supports Zookeeper 3.5.X, with soft compatibility for 3.4.X  
Curator 2.X supports Zookeeper 3.4.X  

5. MySQL version check:  
mysql> select version();  
+-----------+  
| version() |  
+-----------+  
| 5.7.44    |  
+-----------+  
1 row in set (0.00 sec)  

2. Inisialisasi

2.1 Inisialisasi database

source /Users/xxx/IdeaProjects/dolphinscheduler/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql;  

2.2 Konfigurasi Utama Secara umum

# Local directory for storing scripts  
data.basedir.path=/tmp/dolphinscheduler  

# Storage medium selection (e.g., HDFS); for resource center and tenant directories  
resource.storage.type=HDFS  

# Root directory of resource center  
resource.storage.upload.base.path=/dolphinscheduler  

# User for HDFS operations (typically hdfs user)  
resource.hdfs.root.user=hdfs  

# HDFS defaultFS (for HA mode, place core-site.xml and hdfs-site.xml in resources folder)  
resource.hdfs.fs.defaultFS=hdfs://10.253.26.85:8020  

# Development mode (recommended for easier troubleshooting)  
development.state=true  

# YARN port  
resource.manager.httpaddress.port=8088  

# For YARN HA, configure multiple IPs separated by commas  
yarn.resourcemanager.ha.rm.ids=  

# For single YARN, replace ds1 with YARN IP; leave unchanged for HA mode  
yarn.application.status.address=http://ds1:%s/ws/v1/cluster/apps/%s  

2.3 Konfigurasikan Application.YAML untuk setiap layanan

Catatan: Terutama Konfigurasi Alamat Koneksi ZooKeeper dan Alamat MySQL (detail dihilangkan).

2.4 Konfigurasikan Logback-Spring.xml untuk setiap layanan

Mengatur untuk output konsol.

Inilah terjemahan bahasa Inggris line-by-line:

3. Startup komponen

1) MasterServer:
Execute the main method of org.apache.dolphinscheduler.server.master.MasterServer in IntelliJ IDEA,
with VM Options:
-Dlogging.config=classpath:logback-spring.xml 
-Ddruid.mysql.usePingMethod=false 
-Dspring.profiles.active=mysql

2) WorkerServer:
Execute the main method of org.apache.dolphinscheduler.server.worker.WorkerServer in IntelliJ IDEA,
with VM Options:
-Dlogging.config=classpath:logback-spring.xml 
-Ddruid.mysql.usePingMethod=false 
-Dspring.profiles.active=mysql

3) ApiApplicationServer:
Execute the main method of org.apache.dolphinscheduler.api.ApiApplicationServer in IntelliJ IDEA,
with VM Options:
-Dlogging.config=classpath:logback-spring.xml 
-Dspring.profiles.active=api,mysql

After startup, you can browse OpenAPI documentation at:
http://localhost:12345/dolphinscheduler/swagger-ui/index.html

4) Frontend:
cd dolphinscheduler-ui
pnpm install
pnpm run dev

Error encountered:
qiaozhanwei@ dolphinscheduler-ui % pnpm run dev
> [email protected] dev /Users/qiaozhanwei/IdeaProjects/dolphinscheduler/dolphinscheduler-ui 
> vite

error when starting dev server:
Error: listen EADDRNOTAVAIL: address not available 192.168.1.4:5173
    at Server.setupListenHandle [as _listen2] (node:net:1313:21)
    at listenInCluster (node:net:1378:12)
    at GetAddrInfoReqWrap.doListen [as callback] (node:net:1516:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8)

Code modification:
On Mac, find IP address in terminal using command:
ipconfig getifaddr en0

After finding IP address, locate vite.config.ts file in project and modify as follows:

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [vue()],
    base:'/',
    server:{
        host:'192.168.x.x',
        port:'5173',
        https:'false',
        open:'true',
        hmr:{
            protocol:'ws',
            host:'192.168.x.x'
        },
    }
})

Login URL:
http://10.x.x.x/login 
Use credentials admin/dolphinscheduler123 to login

4. Versi 2.x Startup Komponen

api server:
-Dlogging.config=classpath.logback-api.xml 
-Ddruid.mysql.usePingMethod=false 
-Dspring.profiles.active="default,api,mysql"

master:
-Dlogging.config=classpath.logback-master.xml 
-Ddruid.mysql.usePingMethod=false 
-Dspring.profiles.active="default,master,mysql"

worker:
-Dlogging.config=classpath.logback-worker.xml 
[Note:The worker configuration appears to be truncated in original text]