DolphinScheduler分布式调度平台搭建
DolphinScheduler单机方式搭建
1. 部署规划
主机名 | ip地址 | 服务 |
---|---|---|
h3 | 10.64.160.183 | zk,master,worker |
2. 准备工作
CentOS版本:7.9
JDK版本:1.8.0_181
MySQL版本:8.0.25
Zookeeper版本:3.8.4
dolphinscheduler版本:3.2.2
2.1 创建部署用户并配置免登录
#创建用户
useradd dolphinscheduler
#设置密码
echo "dolphinscheduler" | passwd --stdin dolphinscheduler
#配置sudo免密
sed -i '$adolphinscheduler ALL=(ALL) NOPASSWD: NOPASSWD: ALL' /etc/sudoers
#注释
sed -i 's/Defaults requirett/#Defaults requirett/g' /etc/sudoers
如果/etc/sudoers文件中有“Defaults requirett”这行,需要注释掉
2.2 配置机器免密登录
略(安装Doris已做过免密)
3. 安装ZooKeeper
cd /app
tar -zxvf apache-zookeeper-3.8.4-bin.tar.gz -C ./
mv apache-zookeeper-3.8.4-bin/ zookeeper-3.8.4/
cd zookeeper-3.8.4
mkdir zkData
cd zkData
vim myid
##内容##
1
####
cd /app/zookeeper-3.8.4/conf
mv zoo_sample.cfg zoo.cfg
vim zoo.cfg
##内容##
#修改数据存储路径配置
dataDir=/app/zookeeper-3.8.4/zkData/
#增加如下配置
#######################cluster##########################
server.3=h3:2888:3888
##内容结束##
cd /app/zookeeper-3.8.4/
#启动:
bin/zkServer.sh start
#查看状态:
bin/zkServer.sh status
#停止:
bin/zkServer.sh stop
4. 初始化MySQL
DolpinScheduler的元数据储可以存在MySQL/PostgreSQL,这里选择MySQL8.0.25
创建数据库,用户,授权(在h2操作)
mysql -hh2 -P3306 -uroot -p123456
-- 创建dolpinscheduler用户并设置密码,设置登录范围%
CREATE USER 'dolpinscheduler'@'%' IDENTIFIED BY '123456';
-- 创建dolpinscheduler的元数据库,指定编码
CREATE DATABASE dolpinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
-- 为dolpinscheduler授权
GRANT ALL PRIVILEGES ON dolpinscheduler.* TO 'dolpinscheduler'@'%';
-- 刷新权限
FLUSH PRIVILEGES;
5. 安装
5.1 上传dolpinscheduler安装包并解压
cd /app
tar -zxvf apache-dolphinscheduler-3.2.2-bin.tar.gz -C /app/
mv apache-dolphinscheduler-3.2.2-bin/ dolphinscheduler-3.2.2/
#上传驱动
cp /app/mysql-connector-java-8.0.17.jar /app/dolphinscheduler-3.2.2/api-server/libs
cp /app/mysql-connector-java-8.0.17.jar /app/dolphinscheduler-3.2.2/alert-server/libs
cp /app/mysql-connector-java-8.0.17.jar /app/dolphinscheduler-3.2.2/master-server/libs
cp /app/mysql-connector-java-8.0.17.jar /app/dolphinscheduler-3.2.2/worker-server/libs
cp /app/mysql-connector-java-8.0.17.jar /app/dolphinscheduler-3.2.2/tools/libs
#修改配置文件
cd /app/dolphinscheduler-3.2.2/bin/env
vim dolphinscheduler_env.sh
##内容开始##
# JDK环境
export JAVA_HOME=${JAVA_HOME:-/usr/java/jdk1.8.0_181}
# 数据库
export DATABASE=${DATABASE:-mysql}
export SPRING_PROFILES_ACTIVE=${DATABASE}
export SPRING_DATASOURCE_URL="jdbc:mysql://h2:3306/dolpinscheduler?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true"
export SPRING_DATASOURCE_USERNAME=${SPRING_DATASOURCE_USERNAME:-"dolpinscheduler"}
export SPRING_DATASOURCE_PASSWORD=${SPRING_DATASOURCE_PASSWORD:-"123456"}
# 时区信息
# DolphinScheduler server related configuration
export SPRING_CACHE_TYPE=${SPRING_CACHE_TYPE:-none}
export SPRING_JACKSON_TIME_ZONE=${SPRING_JACKSON_TIME_ZONE:-UTC}
export MASTER_FETCH_COMMAND_NUM=${MASTER_FETCH_COMMAND_NUM:-10}
# zookerper
# Registry center configuration, determines the type and link of the registry center
export REGISTRY_TYPE=${REGISTRY_TYPE:-zookeeper}
export REGISTRY_ZOOKEEPER_CONNECT_STRING=${REGISTRY_ZOOKEEPER_CONNECT_STRING:-h3:2181}
# 下边的环境变量网上很多会让在这个地方设置
export PYTHON_HOME=${PYTHON_HOME:-/usr/bin/python}
export DATAX_HOME=${DATAX_HOME:-/app/datax}
export PATH=$JAVA_HOME/bin:$PYTHON_HOME/bin:$DATAX_HOME/bin:$PATH
##内容结束##
#修改install_env.sh
cd /app/dolphinscheduler-3.2.2/bin/env
vim install_env.sh
##内容开始##
#机器主机名
ips="h3"
sshPort="22"
#masters机器
masters="h3"
workers="h3:default"
alertServer="h3"
apiServers="h3"
#软件安装目录
installPath="/usr/local/dolphinscheduler-3.2.2"
#跨机器交互的用户名
deployUser="dolphinscheduler"
#zk根目录
zkRoot=${zkRoot:-"/dolphinscheduler"}
##内容结束##
#给用户dolphinscheduler赋权:
chown -R dolphinscheduler:dolphinscheduler /app/dolphinscheduler-3.2.2/
cd /app/dolphinscheduler-3.2.2
sh tools/bin/upgrade-schema.sh
#执行安装
cd /app/dolphinscheduler-3.2.2
bin/install.sh
#浏览器访问(账号/密码:admin/dolphinscheduler123)
http://h3:12345/dolphinscheduler/ui
6. 启停
## 启动
cd /usr/local/dolphinscheduler-3.2.0/
#全局启动
bin/start-all.sh
#单个服务启动
bin/dolphinscheduler-daemon.sh stop master-server
bin/dolphinscheduler-daemon.sh stop api-server
bin/dolphinscheduler-daemon.sh stop alert-server
bin/dolphinscheduler-daemon.sh stop worker-server
// 停止
cd /usr/local/dolphinscheduler-3.2.0
#全局停止
bin/stop-all.sh
#单个服务停止
bin/dolphinscheduler-daemon.sh start master-server
bin/dolphinscheduler-daemon.sh start api-server
bin/dolphinscheduler-daemon.sh start alert-server
bin/dolphinscheduler-daemon.sh start worker-server
// 查看日志
tail -f /usr/local/dolphinscheduler-3.2.0/master-server/logs/dolphinscheduler-master.log
tail -f /usr/local/dolphinscheduler-3.2.0/api-server/logs/dolphinscheduler-api.log
tail -f /usr/local/dolphinscheduler-3.2.0/alert-server/logs/dolphinscheduler-alert.log
tail -f /usr/local/dolphinscheduler-3.2.0/worker-server/logs/dolphinscheduler-worker.log
http://h3:12345/dolphinscheduler/swagger-ui/index.html?language=zh_CN&lang=cn
# 下边的环境变量网上很多会让在这个地方设置
export JAVA_HOME=/usr/java/jdk1.8.0_181
export PYTHON_LAUNCHER=/usr/bin/python
export DATAX_LAUNCHER=/mnt/sdb/module/datax/bin/datax.py
export FLINK_HOME=/mnt/sdb/module/flink
export PATH=$JAVA_HOME/bin:$PYTHON_LAUNCHER:$FLINK_HOME/bin:$DATAX_LAUNCHER:$PATH
DolphinScheduler分布式集群方式搭建
1. 部署规划
主机名 | ip地址 | 服务 |
---|---|---|
h3 | 10.64.160.183 | zk,master,worker |
h2 | 10.64.160.182 | zk,master,worker,mysql |
h1 | 10.64.160.181 | zk,worker |
2. 准备工作
CentOS版本:7.9
JDK版本:1.8.0_181
MySQL版本:8.0.25
MySQL驱动:mysql-connector-java-8.0.17.jar
Zookeeper版本:3.5.7
dolphinscheduler版本:3.2.0
2.1 创建部署用户并配置免登录
#创建用户
useradd dolphinscheduler
#设置密码
echo "dolphinscheduler" | passwd --stdin dolphinscheduler
#配置sudo免密
sed -i '$adolphinscheduler ALL=(ALL) NOPASSWD: NOPASSWD: ALL' /etc/sudoers
#注释
sed -i 's/Defaults requirett/#Defaults requirett/g' /etc/sudoers
如果/etc/sudoers文件中有“Defaults requirett”这行,需要注释掉
2.2 配置机器免密登录
略(安装Doris已做过免密)
3. 安装ZooKeeper
3.1 上传安装包到h2
cd /mnt/sdb/software
rz -E
3.2 解压重命名
tar -zxvf apache-zookeeper-3.5.7-bin.tar.gz -C ../module
cd ../module
mv apache-zookeeper-3.5.7-bin/ zookeeper-3.5.7
cd zookeeper-3.5.7
mkdir zkData
cd zkData
vim myid
内容
2
3.3 配置zoo.cfg文件
cd /mnt/sdb/module/zookeeper-3.5.7/conf
mv zoo_sample.cfg zoo.cfg
vim zoo.cfg
#修改数据存储路径配置
dataDir=/mnt/sdb/module/zookeeper-3.5.7/zkData
#增加如下配置
#######################cluster##########################
server.1=h1:2888:3888
server.2=h2:2888:3888
server.3=h3:2888:3888
3.4 分发到另外两台机器(xsync/scp):
cd /mnt/sdb/module
xsync zookeeper-3.5.7
分别在 h1、h3上修改 myid 文件中内容为 1、3
3.5 启动与关闭(三台执行)
cd /mnt/sdb/module/zookeeper-3.5.7
启动:bin/zkServer.sh start
查看状态:bin/zkServer.sh status
停止:bin/zkServer.sh stop
4. 初始化MySQL
DolpinScheduler的元数据储可以存在MySQL/PostgreSQL,这里选择MySQL8.0.25
4.1 创建数据库,用户,授权(在h2操作)
mysql -hh2 -P3306 -uroot -p123456
-- 创建dolpinscheduler用户并设置密码,设置登录范围%
CREATE USER 'dolpinscheduler'@'%' IDENTIFIED BY '123456';
-- 创建dolpinscheduler的元数据库,指定编码
CREATE DATABASE dolpinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
-- 为dolpinscheduler授权
GRANT ALL PRIVILEGES ON dolpinscheduler.* TO 'dolpinscheduler'@'%';
-- 刷新权限
FLUSH PRIVILEGES;
4.2 上传dolpinscheduler安装包并解压(在h3操作)
cd /mnt/sdb/software
rz -E
ls
解压到 /mnt/sdb/module
tar -zxvf apache-dolphinscheduler-3.2.0-bin.tar.gz -C /mnt/sdb/module/
cd /mnt/sdb/module
mv apache-dolphinscheduler-3.2.0-bin/ dolphinscheduler-3.2.0/
4.3 添加MySQL驱动(在h3操作)
上传驱动到software文件夹
rz -E
复制到一下目录
cp /mnt/sdb/software/mysql-connector-java-8.0.17.jar /mnt/sdb/module/dolphinscheduler-3.2.0/api-server/libs
cp /mnt/sdb/software/mysql-connector-java-8.0.17.jar /mnt/sdb/module/dolphinscheduler-3.2.0/alert-server/libs
cp /mnt/sdb/software/mysql-connector-java-8.0.17.jar /mnt/sdb/module/dolphinscheduler-3.2.0/master-server/libs
cp /mnt/sdb/software/mysql-connector-java-8.0.17.jar /mnt/sdb/module/dolphinscheduler-3.2.0/worker-server/libs
cp /mnt/sdb/software/mysql-connector-java-8.0.17.jar /mnt/sdb/module/dolphinscheduler-3.2.0/tools/libs
4.4 修改dolphinscheduler_env.sh配置文件(在h3操作)
/mnt/sdb/module/dolphinscheduler-3.2.0/bin/env
vim dolphinscheduler_env.sh
内容:
# JDK环境
export JAVA_HOME=${JAVA_HOME:-/usr/java/jdk1.8.0_181}
# 数据库
export DATABASE=${DATABASE:-mysql}
export SPRING_PROFILES_ACTIVE=${DATABASE}
export SPRING_DATASOURCE_URL="jdbc:mysql://h2:3306/dolpinscheduler?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true"
export SPRING_DATASOURCE_USERNAME=${SPRING_DATASOURCE_USERNAME:-"dolpinscheduler"}
export SPRING_DATASOURCE_PASSWORD=${SPRING_DATASOURCE_PASSWORD:-"123456"}
# 时区信息
# DolphinScheduler server related configuration
export SPRING_CACHE_TYPE=${SPRING_CACHE_TYPE:-none}
export SPRING_JACKSON_TIME_ZONE=${SPRING_JACKSON_TIME_ZONE:-UTC}
export MASTER_FETCH_COMMAND_NUM=${MASTER_FETCH_COMMAND_NUM:-10}
# zookerper
# Registry center configuration, determines the type and link of the registry center
export REGISTRY_TYPE=${REGISTRY_TYPE:-zookeeper}
export REGISTRY_ZOOKEEPER_CONNECT_STRING=${REGISTRY_ZOOKEEPER_CONNECT_STRING:-h1:2181,h2:2181,h3:2181}
# 下边的环境变量网上很多会让在这个地方设置
export PYTHON_HOME=${PYTHON_HOME:-/usr/bin/python}
export DATAX_HOME=${DATAX_HOME:-/mnt/sdb/module/datax}
export FLINK_HOME=${FLINK_HOME:-/mnt/sdb/module/flink}
export PATH=$JAVA_HOME/bin:$PYTHON_HOME/bin:$FLINK_HOME/bin:$DATAX_HOME/bin:$PATH
给用户dolphinscheduler赋权:
chown -R dolphinscheduler:dolphinscheduler /mnt/sdb/module/dolphinscheduler-3.2.0/
cd /mnt/sdb/module/dolphinscheduler-3.2.0
sh tools/bin/upgrade-schema.sh
5. 安装
5.1 修改install_env.sh
修改内容
#机器主机名
ips="h1,h2,h3"
sshPort="22"
#masters机器
masters="h2,h3"
workers="h1:default,h2:default,h3:default"
alertServer="h2"
apiServers="h3"
#软件安装目录
installPath="/usr/local/dolphinscheduler-3.2.0"
#跨机器交互的用户名
deployUser="dolphinscheduler"
#zk根目录
zkRoot=${zkRoot:-"/dolphinscheduler"}
5.2 安装
cd /mnt/sdb/module/dolphinscheduler-3.2.0
sh bin/install.sh
5.3 安装成功
http://h3:12345/dolphinscheduler/ui
http://h2:12345/dolphinscheduler/ui
账号:admin
密码:dolphinscheduler123
6. 启停
## 启动
cd /usr/local/dolphinscheduler-3.2.0/
#全局启动
bin/start-all.sh
#单个服务启动
bin/dolphinscheduler-daemon.sh stop master-server
bin/dolphinscheduler-daemon.sh stop api-server
bin/dolphinscheduler-daemon.sh stop alert-server
bin/dolphinscheduler-daemon.sh stop worker-server
// 停止
cd /usr/local/dolphinscheduler-3.2.0
#全局停止
bin/stop-all.sh
#单个服务停止
bin/dolphinscheduler-daemon.sh start master-server
bin/dolphinscheduler-daemon.sh start api-server
bin/dolphinscheduler-daemon.sh start alert-server
bin/dolphinscheduler-daemon.sh start worker-server
// 查看日志
tail -f /usr/local/dolphinscheduler-3.2.0/master-server/logs/dolphinscheduler-master.log
tail -f /usr/local/dolphinscheduler-3.2.0/api-server/logs/dolphinscheduler-api.log
tail -f /usr/local/dolphinscheduler-3.2.0/alert-server/logs/dolphinscheduler-alert.log
tail -f /usr/local/dolphinscheduler-3.2.0/worker-server/logs/dolphinscheduler-worker.log
http://h3:12345/dolphinscheduler/swagger-ui/index.html?language=zh_CN&lang=cn
# 下边的环境变量网上很多会让在这个地方设置
export JAVA_HOME=/usr/java/jdk1.8.0_181
export PYTHON_LAUNCHER=/usr/bin/python
export DATAX_LAUNCHER=/mnt/sdb/module/datax/bin/datax.py
export FLINK_HOME=/mnt/sdb/module/flink
export PATH=$JAVA_HOME/bin:$PYTHON_LAUNCHER:$FLINK_HOME/bin:$DATAX_LAUNCHER:$PATH
7.添加驱动
7.1 HANA驱动
7.2 Oracle驱动
7.3 Doris驱动
8. 下线机器
因为没有分布式文件系统存储资源中心文件,所以下线其它机器,保留机器h3
下线步骤:
# 1)停止集群:
$DOLPHINSCHEDULER_HOME/bin/stop-all.sh
# 2)修改配置文件install_env.sh
cd $DOLPHINSCHEDULER_HOME/bin/env
cp install_env.sh install_env.sh.bak
vim install_env.sh
##内容:##
#把其它work节点删掉,并把其它组件节点改成h3
####
# 3)重启
$DOLPHINSCHEDULER_HOME/bin/start-all.sh
原文地址:https://blog.csdn.net/weixin_44449054/article/details/144289513
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!