DolphinScheduler 集群模式部署

该文详细介绍了DolphinScheduler的集群模式部署步骤,包括集群规划、前置准备、安装包解压、数据库创建和用户配置、一键部署脚本的配置以及数据库初始化。重点强调了多台服务器上JDK、数据库、Zookeeper的安装,以及DolphinScheduler各组件如Master、Worker的配置和启动命令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

DolphinScheduler 集群模式部署

一、集群规划

集群模式下,可配置多个 Master 及多个 Worker。通常可配置 2~3 个 Master,若干个
Worker。由于集群资源有限,此处配置一个 Master,三个 Worker,集群规划如下。
在这里插入图片描述

1、前置准备工作

(1)三台节点均需部署 JDK(1.8+),并配置相关环境变量。
(2)需部署数据库,支持 MySQL(5.7+)或者 PostgreSQL(8.2.15+)。
(3)需部署 Zookeeper(3.4.6+)。
(4)三台节点均需安装进程树分析工具 psmisc。
输入命令: sudo yum install -y psmisc 三台节点执行
在这里插入图片描述

2、解压DolphinScheduler 安装包

(1)上传 DolphinScheduler 安装包到 hadoop102 节点的/opt/software 目录
(2)解压安装包到当前目录
输入目录:tar -zxvf apache-dolphinscheduler-2.0.5-bin.tar.gz -C /opt/software/

3、创建元数据库及用户

DolphinScheduler 元数据存储在关系型数据库中,故需创建相应的数据库和用户。
(1)创建数据库
输入目录:CREATE DATABASE dolphinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
(2)创建用户
输入命令: create user 'dolpinscheduler'@'%' identified by 'dolpinscheduler';
(3)赋予用户相应权限
输入命令:GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'dolphinscheduler'@'%';
输入命令: flush privileges;

二、配置一键部署脚本

输入命令: cd apache-dolphinscheduler-2.0.5-bin
输入命令:vim conf/config/install_config.conf 配置文件内容如下

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# ---------------------------------------------------------
# INSTALL MACHINE
# ---------------------------------------------------------
# A comma separated list of machine hostname or IP would be installed DolphinScheduler,
# including master, worker, api, alert. If you want to deploy in pseudo-distributed
# mode, just write a pseudo-distributed hostname
# Example for hostnames: ips="ds1,ds2,ds3,ds4,ds5", Example for IPs: ips="192.168.8.1,192.168.8.2,192.168.8.3,192.168.8.4,192.168.8.5"
ips="hadoop102,hadoop103,hadoop104"

# Port of SSH protocol, default value is 22. For now we only support same port in all `ips` machine
# modify it if you use different ssh port
sshPort="22"

# A comma separated list of machine hostname or IP would be installed Master server, it
# must be a subset of configuration `ips`.
# Example for hostnames: masters="ds1,ds2", Example for IPs: masters="192.168.8.1,192.168.8.2"
masters="hadoop102"

# A comma separated list of machine <hostname>:<workerGroup> or <IP>:<workerGroup>.All hostname or IP must be a
# subset of configuration `ips`, And workerGroup have default value as `default`, but we recommend you declare behind the hosts
# Example for hostnames: workers="ds1:default,ds2:default,ds3:default", Example for IPs: workers="192.168.8.1:default,192.168.8.2:default,192.168.8.3:default"
workers="hadoop102:default,hadoop103:default,hadoop104:default"

# A comma separated list of machine hostname or IP would be installed Alert server, it
# must be a subset of configuration `ips`.
# Example for hostname: alertServer="ds3", Example for IP: alertServer="192.168.8.3"
alertServer="hadoop102"

# A comma separated list of machine hostname or IP would be installed API server, it
# must be a subset of configuration `ips`.
# Example for hostname: apiServers="ds1", Example for IP: apiServers="192.168.8.1"
apiServers="hadoop102"

# A comma separated list of machine hostname or IP would be installed Python gateway server, it
# must be a subset of configuration `ips`.
# Example for hostname: pythonGatewayServers="ds1", Example for IP: pythonGatewayServers="192.168.8.1"
pythonGatewayServers="ds1"

# The directory to install DolphinScheduler for all machine we config above. It will automatically be created by `install.sh` script if not exists.
# Do not set this configuration same as the current path (pwd)
installPath="/opt/dolphinscheduler"

# The user to deploy DolphinScheduler for all machine we config above. For now user must create by yourself before running `install.sh`
# script. The user needs to have sudo privileges and permissions to operate hdfs. If hdfs is enabled than the root directory needs
# to be created by this user
deployUser="root"

# The directory to store local data for all machine we config above. Make sure user `deployUser` have permissions to read and write this directory.
dataBasedirPath="/tmp/dolphinscheduler"

# ---------------------------------------------------------
# DolphinScheduler ENV
# ---------------------------------------------------------
# JAVA_HOME, we recommend use same JAVA_HOME in all machine you going to install DolphinScheduler
# and this configuration only support one parameter so far.
javaHome="/opt/jdk1.8"

# DolphinScheduler API service port, also this is your DolphinScheduler UI component's URL port, default value is 12345
apiServerPort="12345"

# ---------------------------------------------------------
# Database
# NOTICE: If database value has special characters, such as `.*[]^${}\+?|()@#&`, Please add prefix `\` for escaping.
# ---------------------------------------------------------
# The type for the metadata database
# Supported values: ``postgresql``, ``mysql`, `h2``.
DATABASE_TYPE="mysql"

# Spring datasource url, following <HOST>:<PORT>/<database>?<parameter> format, If you using mysql, you could use jdbc
# string jdbc:mysql://127.0.0.1:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8 as example
SPRING_DATASOURCE_URL="jdbc:mysql://hadoop102:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8"
# Spring datasource username
SPRING_DATASOURCE_USERNAME="dolphinscheduler"

# Spring datasource password
SPRING_DATASOURCE_PASSWORD="dolphinscheduler"

# ---------------------------------------------------------
# Registry Server
# ---------------------------------------------------------
# Registry Server plugin name, should be a substring of `registryPluginDir`, DolphinScheduler use this for verifying configuration consistency
registryPluginName="zookeeper"

# Registry Server address.
registryServers="hadoop102:2181,hadoop103:2181,hadoop104:2181"

# Registry Namespace
registryNamespace="dolphinscheduler"

# ---------------------------------------------------------
# Worker Task Server
# ---------------------------------------------------------
# Worker Task Server plugin dir. DolphinScheduler will find and load the worker task plugin jar package from this dir.
taskPluginDir="lib/plugin/task"

# resource storage type: HDFS, S3, NONE
resourceStorageType="HDFS"

# resource store on HDFS/S3 path, resource file will store to this hdfs path, self configuration, please make sure the directory exists on hdfs and has read write permissions. "/dolphinscheduler" is recommended
resourceUploadPath="/dolphinscheduler"

# if resourceStorageType is HDFS,defaultFS write namenode address,HA, you need to put core-site.xml and hdfs-site.xml in the conf directory.
# if S3,write S3 address,HA,for example :s3a://dolphinscheduler,
# Note,S3 be sure to create the root directory /dolphinscheduler
defaultFS="hdfs://hadoop102:8020"

# if resourceStorageType is S3, the following three configuration is required, otherwise please ignore
s3Endpoint="http://192.168.xx.xx:9010"
s3AccessKey="xxxxxxxxxx"
s3SecretKey="xxxxxxxxxx"

# resourcemanager port, the default value is 8088 if not specified
resourceManagerHttpAddressPort="8088"

# if resourcemanager HA is enabled, please set the HA IPs; if resourcemanager is single node, keep this value empty
yarnHaIps="192.168.xx.xx,192.168.xx.xx"

# if resourcemanager HA is enabled or not use resourcemanager, please keep the default value; If resourcemanager is single node, you only need to replace 'yarnIp1' to actual resourcemanager hostname
singleYarnIp="hadoop103"

# who has permission to create directory under HDFS/S3 root path
# Note: if kerberos is enabled, please config hdfsRootUser=
hdfsRootUser="root"

# kerberos config
# whether kerberos starts, if kerberos starts, following four items need to config, otherwise please ignore
kerberosStartUp="false"
# kdc krb5 config file path
krb5ConfPath="$installPath/conf/krb5.conf"
# keytab username,watch out the @ sign should followd by \\
keytabUserName="hdfs-mycluster\\@ESZ.COM"
# username keytab path
keytabPath="$installPath/conf/hdfs.headless.keytab"
# kerberos expire time, the unit is hour
kerberosExpireTime="2"

# use sudo or not
sudoEnable="true"

# worker tenant auto create
workerTenantAutoCreate="false"

1、初始化数据库

(1)拷贝mysql8.0 驱动
拷贝 MySQL 驱动到 DolphinScheduler 的解压目录下的 lib 中,要求使用 MySQL
JDBC Driver 8.0.16 要匹配对应的版本
输入命令: cp mysql-connector-java-8.0.16.jar /opt/software/apache-dolphinscheduler-2.0.5-bin/lib/
在这里插入图片描述
(2)执行数据库初始化脚本
数据库初始化脚本位于 DolphinScheduler 解 压 目 录 下 的 script 目 录 中 , 即
/opt/software/ds/apache-dolphinscheduler-2.0.5-bin/script/
输入命令:/opt/software/ds/apache-dolphinscheduler-2.0.5-bin/script/
在这里插入图片描述

2、一键部署 DolphinScheduler

(1)启动 Zookeeper 集群
输入命令: zkServer.sh start 三台节点都执行一下,这个是在zookeeper bin目录下命令
在这里插入图片描述
(2)一键部署并启动 DolphinScheduler
输入命令:./install.sh
在这里插入图片描述
(3)查看 DolphinScheduler 进程
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
(4)访问 DolphinScheduler UI
DolphinScheduler UI 地址为:http://hadoop102:12345/dolphinscheduler
初始用户:admin 初始密码:dolphinscheduler123
在这里插入图片描述
进入这个界面,说明成功了
在这里插入图片描述

3、DolphinScheduler 启停命令

DolphinScheduler 的启停脚本均位于其安装目录的 bin 目录下。
1)一键启停所有服务
./bin/start-all.sh
./bin/stop-all.sh
注意同 Hadoop 的启停脚本进行区分。
2)启停 Master
./bin/dolphinscheduler-daemon.sh start master-server
./bin/dolphinscheduler-daemon.sh stop master-server
3)启停 Worker
./bin/dolphinscheduler-daemon.sh start worker-server
./bin/dolphinscheduler-daemon.sh stop worker-server
4)启停 Api
./bin/dolphinscheduler-daemon.sh start api-server
./bin/dolphinscheduler-daemon.sh stop api-server
5)启停 Logger
./bin/dolphinscheduler-daemon.sh start logger-server
./bin/dolphinscheduler-daemon.sh stop logger-server
6)启停 Alert
./bin/dolphinscheduler-daemon.sh start alert-server
./bin/dolphinscheduler-daemon.sh stop alert-server
服务全部启动之后
在这里插入图片描述

<think>我们正在处理关于DolphinScheduler集群部署的查询。根据引用内容,我们可以整理出部署的关键步骤和前提条件。引用[1]提到伪集群部署概述,引用[2]提供了详细的安装准备和步骤,引用[3]则涉及环境配置的同步。部署前提条件(引用[2]):1.JDK1.8+2.MySQL5.7+以及MySQL驱动8.0.16+3.ZooKeeper3.4.6+4.psmisc(用于进程树分析)部署步骤(综合引用[1][2][3]):1.安装准备:确保所有前提条件满足。2.下载DolphinScheduler3.1.5版本。3.配置环境变量(bin/env/dolphinscheduler_env.sh),并在部署时同步到各个服务节点(引用[3])。4.进行必要的配置修改,如数据库连接、ZooKeeper连接等。5.执行安装脚本。由于引用中并没有给出完整的详细步骤,但我们可以根据常见的部署流程和引用中的提示来组织答案。同时,我们应提醒用户参考官方文档获取最新信息。注意:用户要求生成相关问题,因此我们将在回答后提出几个相关问题。</think>### DolphinScheduler集群部署指南 根据引用内容,以下是 DolphinScheduler集群部署的核心步骤和配置要点: #### 一、部署前提条件[^2] 1. **软件版本要求**: - JDK 1.8+ - MySQL 5.7+(驱动版本 8.0.16+) - ZooKeeper 3.4.6+ - psmisc(进程树分析工具) 2. **环境准备**: ```bash # 安装必需工具 yum install psmisc -y ``` #### 二、部署流程[^1][^2] 1. **下载和解压**: ```bash wget https://dlcdn.apache.org/dolphinscheduler/3.1.5/apache-dolphinscheduler-3.1.5-bin.tar.gz tar -zxvf apache-dolphinscheduler-3.1.5-bin.tar.gz ``` 2. **配置环境变量**: 修改 `bin/env/dolphinscheduler_env.sh` 文件: ```bash export JAVA_HOME=/usr/lib/jvm/java-1.8.0 export DATABASE=mysql export SPRING_PROFILES_ACTIVE=mysql ``` 3. **数据库初始化**: ```sql CREATE DATABASE dolphinscheduler DEFAULT CHARSET utf8; GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'ds_user'@'%' IDENTIFIED BY 'ds_password'; ``` 4. **修改核心配置**: - `conf/application.yaml`:配置数据库连接 ```yaml spring: datasource: url: jdbc:mysql://localhost:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8 username: ds_user password: ds_password ``` 5. **启动服务**: ```bash # 一键启动所有服务(伪集群模式) ./bin/dolphinscheduler-daemon.sh start all ``` #### 三、关键配置说明[^3] 1. **环境同步机制**: - 部署时 `bin/env/dolphinscheduler_env.sh` 的内容会自动同步到所有节点的 `conf/dolphinscheduler_env.sh` 2. **ZooKeeper 配置**: ```properties # conf/zookeeper.properties zookeeper.quorum=localhost:2181 ``` 3. **访问控制台**: - 默认地址:`http://服务器IP:12345/dolphinscheduler` - 默认账号:`admin`/`dolphinscheduler123` #### 四、验证部署 ```bash # 检查服务状态 ./bin/dolphinscheduler-daemon.sh status all # 预期输出 MasterServer is running WorkerServer is running ApiServer is running LoggerServer is running ``` > **注意**:伪集群部署是在单机模拟分布式环境,所有服务共用一个节点,适合开发和测试场景。生产环境请使用真实集群部署[^1]。 --- ### 相关问题 1. DolphinScheduler集群部署和真实集群部署的主要区别是什么? 2. 部署过程中遇到 ZooKeeper 连接失败应如何排查? 3. DolphinScheduler 如何实现高可用容错机制? 4. 如何扩展 DolphinScheduler 的 Worker 节点以提升任务并发能力? 5. DolphinScheduler 支持哪些类型的任务调度?(如 Shell、SQL、Spark 等) [^1]: Apache DolphinScheduler集群部署指南 [^2]: Hadoop生态圈框架部署集群版(十)- DolphinScheduler伪分布式部署 [^3]: dolphinscheduler集群服务一键安装启动实现流程剖析
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值