深入解析DolphinScheduler多存儲插件架構




深入淺出 Apache DolphinScheduler 的可插拔儲存系統

作者:周杰光,發布日期:2025 年 5 月 29 日

![](https://hackernoon.imgix.net/arrow-dark.png)

太長;沒讀完
———————

從 LOCAL 到 HDFS、S3 及更遠 — 深入探討其可插拔儲存系統、配置最佳實踐和架構!

### 提及的人物

### 提及的公司

![](https://hackernoon.imgix.net/arrow-dark.png)

Apache DolphinScheduler 的儲存系統提供了一個統一的介面,用於在各種儲存後端儲存和檢索檔案。它實現了工作流和任務的資源管理,允許用戶上傳腳本、JAR 檔案、配置文件和其他可在任務執行中使用的工件。該系統抽象了底層儲存技術,使得在不更改應用程式碼的情況下,可以無縫地在不同的儲存提供商之間切換。

架構概述
———————

儲存系統被設計為一個可插拔的元件,具有跨不同儲存實現的一致 API。這種架構允許 DolphinScheduler 與多個儲存後端合作,同時維護資源操作的統一介面。

![](https://hackernoon.imgix.net/arrow-dark.png)

來源:

* dolphinscheduler-storage-plugin/dolphinscheduler-storage-api/src/main/java/org/apache/dolphinscheduler/plugin/storage/api/StorageType.java 22-62
* dolphinscheduler-common/src/main/resources/common.properties 24-33

支援的儲存類型
———————–

DolphinScheduler 支援以下儲存後端:

![](https://hackernoon.imgix.net/arrow-dark.png)

來源:

* dolphinscheduler-storage-plugin/dolphinscheduler-storage-api/src/main/java/org/apache/dolphinscheduler/plugin/storage/api/StorageType.java 22-36
* docs/docs/en/guide/resource/configuration.md 1-7

插件架構
——————-

儲存功能使用插件架構實現,便於擴展和維護。

![](https://hackernoon.imgix.net/arrow-dark.png)

來源:

* dolphinscheduler-storage-plugin/pom.xml 30-39
* dolphinscheduler-storage-plugin/dolphinscheduler-storage-all/pom.xml 29-54

配置
————-

儲存系統通過 `common.properties` 檔案進行配置。不同的儲存後端需要不同的配置參數。

### 基本配置

# 儲存類型:LOCAL,HDFS,S3,OSS,GCS,ABS,OBS,COS
resource.storage.type=LOCAL

# 資源儲存的基本路徑
resource.storage.upload.base.path=/tmp/dolphinscheduler

來源:

* dolphinscheduler-common/src/main/resources/common.properties 24-27

### 配置流程

當 DolphinScheduler 啟動時,它會載入儲存配置並初始化適當的儲存操作員:

![](https://hackernoon.imgix.net/arrow-dark.png)

來源:

* dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java 49-60

儲存類型特定配置
———————————–

### 本地儲存

本地儲存選項將檔案儲存在運行 DolphinScheduler 的機器的本地檔案系統中。這是預設配置。

resource.storage.type=LOCAL
resource.storage.upload.base.path=/tmp/dolphinscheduler

注意:當使用 LOCAL 儲存類型時,如果有多個 DolphinScheduler 節點,每個節點都有自己的本地檔案系統。這意味著在一個節點上上傳的資源在其他節點上不可自動使用,除非使用共享檔案系統。

來源:

* dolphinscheduler-common/src/main/resources/common.properties 24-27
* docs/docs/en/guide/resource/configuration.md 10-28

### HDFS 儲存

對於 HDFS 儲存,需要額外的配置:

resource.storage.type=HDFS
resource.hdfs.fs.defaultFS=hdfs://namenode:8020
resource.hdfs.root.user=hdfs

如果使用具有 Kerberos 認證的 HDFS,則需要額外的 Kerberos 配置。

來源:

* dolphinscheduler-common/src/main/resources/common.properties 97-115

### S3 儲存

對於 Amazon S3 或相容的 S3 儲存:

resource.storage.type=S3

AWS 連接參數在 `aws.yaml` 檔案中指定:

aws:
s3:
credentials.provider.type: AWSStaticCredentialsProvider
access.key.id:
access.key.secret:
region:
bucket.name:
endpoint:

來源:

* docs/docs/en/guide/resource/configuration.md 29-53

### 其他雲儲存

DolphinScheduler 還支援阿里雲 OSS、華為雲 OBS、騰訊雲 COS、谷歌雲儲存和 Azure Blob 儲存,每種儲存都有其自己的配置參數。

來源:

* docs/docs/en/guide/resource/configuration.md 54-127

資源的資料庫架構
—————————–

除了實際的檔案儲存外,DolphinScheduler 還在其資料庫中維護資源的元資料。相關的表格包括:

* 資源元資料表格(儲存資源的名稱、路徑、所有者等資訊)
* 資源-用戶關聯表格(定義訪問許可權)

來源:

* dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql 729-748

元件間整合
—————————

儲存系統與 DolphinScheduler 的其他元件整合:

![](https://hackernoon.imgix.net/arrow-dark.png)

來源:提示中提供的系統架構圖。

使用注意事項
——————–

選擇儲存類型時,請考慮以下因素:

1. 單節點 vs. 多節點:對於單節點部署,LOCAL 儲存已足夠。對於多節點部署,請考慮 HDFS 或雲儲存。
2. 效能:本地儲存通常提供最佳效能,但缺乏分散式功能。HDFS 為本地部署提供良好的效能,而雲儲存選項適合雲端部署。
3. 可靠性:雲儲存提供商通常提供高耐用性和可用性。對於本地部署,HDFS 具有適當的複製功能,提供可靠的儲存。
4. 整合:如果您已經使用特定的雲提供商或現有的 Hadoop 叢集,使用相應的儲存選項可能最簡單。
5. 成本:不同的儲存選項具有不同的成本結構。雲儲存通常對儲存量、請求和資料傳輸收費。

來源:

* docs/docs/en/guide/resource/configuration.md 13-26
* docs/docs/zh/guide/resource/configuration.md 12-25

配置最佳實踐
—————————-

1. 一致的配置:確保所有 DolphinScheduler 節點(API 伺服器和工作節點伺服器)的儲存配置相同。
2. 許可權:運行 DolphinScheduler 的用戶必須具有訪問所配置儲存的適當許可權。
3. 共享儲存:在分散式部署中,使用共享儲存解決方案(HDFS、S3 等)而不是 LOCAL 儲存,以確保所有節點都可以訪問相同的資源。
4. 安全性:對於雲儲存,使用適當的安全措施,例如 IAM 角色或具有最低所需許可的訪問金鑰。
5. 備份:實施資源儲存的備份策略,尤其是對於關鍵資源。

來源:

* docs/docs/en/guide/resource/configuration.md 95-97
* docs/docs/zh/guide/resource/configuration.md 87-91

作為編輯,我想補充一些見解和評論。DolphinScheduler 的可插拔儲存系統設計得非常靈活和可擴展,允許用戶根據自己的需求選擇最合適的儲存解決方案。無論是本地儲存、HDFS、S3 還是其他雲儲存,用戶都可以根據自己的基礎設施和成本要求進行選擇。

然而,用戶在選擇儲存類型時需要謹慎考慮各種因素,包括效能、可靠性和成本。同時,適當的配置和許可權管理對於確保儲存系統的安全性和可用性至關重要。

此外,DolphinScheduler 的儲存系統與其他元件的整合也非常關鍵,確保了資源的統一管理和訪問。總的來說,DolphinScheduler 的可插拔儲存系統為用戶提供了極大的靈活性和便利性,使得資源管理和工作流排程更加高效和可靠。

🎬 YouTube Premium 家庭 Plan成員一位 只需 HK$148/年

不用提供密碼、不用VPN、無需轉區
直接升級你的香港帳號 ➜ 即享 YouTube + YouTube Music 無廣告播放

立即升級 🔗

🎨 Nano Banana Pro 圖像生成器|打幾句說話就出圖

想畫人像、產品圖、插畫?SSFuture 圖像生成器支援 Flux Gemini Nano Banana Pro 改圖 / 合成, 打廣東話都得,仲可以沿用上一張圖繼續微調。

🆓 Flux 模型即玩,不用登入
🤖 登入後解鎖 Gemini 改圖
📷 支援上載參考圖再生成
⚡ 每天免費額度任你玩
✨ 即刻玩 AI 畫圖
Make this photo use ultra realistis  A man sitting at a futuristic desk, interacting with a large, modern holographic touchscreen display similar to the technology in the Iron Man movies. On the desk, there is an Iron Man gauntlet (Infinity Gauntlet) with all the Infinity Stones glowing on it. Next to the gauntlet, there is a plate of grilled corn on the cob (jagung bakar) and a coffee cup beside the plate. The desk area is clean and free of any cables. The overall setting should be a realistic and modern high-tech lab/room with Iron Man, Captain America, and Black Panther suits displayed in pods behind him. Cinematic lighting, hyper-realistic, high detail. Create a photorealistic movie-poster image for Zootopia 2. The scene shows a young Asian man and an oversized black shirt standing inside a crowded, dimly lit cinema. He’s flanked by Judy Hopps in full police uniform and Nick Wilde, both rendered in their official Disney CGI style. Capture the shot from a low angle so the characters feel larger than life. The cinema screen behind them is glowing with an intense action scene from the film. Let the light from the screen spill across their faces and clothing to create dramatic high contrast. The environment should feel alive with background silhouettes, soft haze, and the warm ambience of a packed theatre. Style the composition like an official Disney promotional poster: epic layout, sharp detail, high resolution, balanced framing, and clean edges. The man and the cinema should be fully photorealistic, while Judy and Nick retain their signature animated look.
At the bottom, include:
• The Disney logo
• The title ZOOTOPIA 2 in bold green and white
• The release line ONLY IN THEATERS NOVEMBER 26 Poster tone: cinematic, polished, high-end theatrical marketing. Replace the words in the bottom by ‘tantamount Deco’