文章目录
1 下载
https://dolphinscheduler.apache.org/zh-cn/docs/release/download.html
2 基础软件安装
- PostgreSQL (8.2.15+) or MySQL (5.7系列) : 两者任选其一即可
- JDK (1.8+) : 必装,请安装好后在/etc/profile下配置 JAVA_HOME 及 PATH 变量
- ZooKeeper (3.4.6+) :必装
- Hadoop (2.6+) or MinIO :选装
3 集群解压缩
3.1 scp到其他节点
3.2 tar开
# 创建部署目录,部署目录请不要创建在/root、/home等高权限目录
mkdir -p /opt/dolphinscheduler;
cd /opt/dolphinscheduler;
tar -zxvf apache-dolphinscheduler-incubating-1.3.1-dolphinscheduler-bin.tar.gz -C /opt/dolphinscheduler;
3.3 重命名
[root@ifeng01 dolphinscheduler]# ll
总用量 0
drwxr-xr-x 9 root root 156 8月 3 22:00 apache-dolphinscheduler-incubating-1.3.1-dolphinscheduler-bin
[root@ifeng01 dolphinscheduler]# mv apache-dolphinscheduler-incubating-1.3.1-dolphinscheduler-bin dolphinscheduler-bin
[root@ifeng01 dolphinscheduler]# ll
总用量 0
drwxr-xr-x 9 root root 156 8月 3 22:00 dolphinscheduler-bin
[root@ifeng01 dolphinscheduler]#
4 创建部署用户和hosts映射
在所有部署调度的机器上创建部署用户,并且一定要配置sudo免密。假如我们计划在ifeng1,ifeng2,ifeng3,这3台机器上部署调度,首先需要在每台机器上都创建部署用户
# 创建用户需使用root登录,设置部署用户名,请自行修改,后面以dolphinscheduler为例
useradd dolphinscheduler;
# 设置用户密码,请自行修改,后面以dolphinscheduler123为例
echo "dolphinscheduler123" | passwd --stdin dolphinscheduler
# 配置sudo免密
echo 'dolphinscheduler ALL=(ALL) NOPASSWD: NOPASSWD: ALL' >> /etc/sudoers
sed -i 's/Defaults requirett/#Defaults requirett/g' /etc/sudoers
4.2 同步到其他
每个主机的hosts保持修改一致
4.3 安装sshpass
通过sshpass -p xxx sudo scp -r /etc/hosts $ip:/etc/就可以省去输入密码
先安装epel
yum install -y epel-release
yum repolist
安装完成epel之后,就可以按照sshpass了
yum install -y sshpass
4.4 免密登录
su dolphinscheduler;
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
注意:正常设置后,dolphinscheduler用户在执行命令ssh localhost 是不需要再输入密码的
for ip in ifeng02 ifeng03; #请将此处ds2 ds3替换为自己要部署的机器的hostname
do
sshpass -p xxx ssh-copy-id $ip #该操作执行过程中需要手动输入dolphinscheduler用户的密码
done
4.5 修改权限
在ds1上,修改目录权限,使得部署用户对dolphinscheduler-bin目录有操作权限
sudo chown -R dolphinscheduler:dolphinscheduler dolphinscheduler-bin
5 数据库初始化
进入数据库,默认数据库是PostgreSQL,如选择MySQL的话,后续需要添加mysql-connector-java驱动包到DolphinScheduler的lib目录下
5.1 数据库用户权限
mysql -h10.103.66.83 -P3306 -uroot -p
#首先添加dolphinscheduler用户
mysql> CREATE DATABASE dolphinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
mysql> grant all privileges on dolphinscheduler.* to "dolphinscheduler"@'%';
GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'dolphinscheduler'@'%' IDENTIFIED BY '132';
mysql> GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'dolphinscheduler'@'localhost' IDENTIFIED BY 'dsroot_83';
flush privileges;
5.2 创建表和导入基础数据
修改 conf 目录下 datasource.properties 中的下列配置
vi conf/datasource.properties
如果选择 MySQL,请注释掉 PostgreSQL 相关配置(反之同理), 还需要手动添加 [ mysql-connector-java 驱动 jar ] 包到 lib 目录下,这里下载的是mysql-connector-java-5.1.47.jar,然后正确配置数据库连接相关信息
#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://ifeng01:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
spring.datasource.username=dolphinscheduler
spring.datasource.password=132
导入基础数据
修改并保存完后,执行 script 目录下的创建表及导入基础数据脚本
sh script/create-dolphinscheduler.sh
注意: 如果执行上述脚本报 ”/bin/java: No such file or directory“ 错误,请在/etc/profile下配置 JAVA_HOME 及 PATH 变量
6 修改运行参数
修改 conf/env 目录下的 dolphinscheduler_env.sh 环境变量
export HADOOP_HOME=/opt/cloudera/parcels/CDH/lib/hadoop
export HADOOP_CONF_DIR=/opt/cloudera/parcels/CDH/lib/hadoop/etc/hadoop
#export SPARK_HOME1=/opt/cloudera/parcels/CDH/lib/spark1
#export SPARK_HOME2=/opt/cloudera/parcels/CDH/lib/spark2
export PYTHON_HOME=/usr/local/python3
export JAVA_HOME=/usr/java/jdk1.8.0_181
export HIVE_HOME=/opt/cloudera/parcels/CDH/lib/hive
#export FLINK_HOME=/opt/cloudera/parcels/CDH/lib/flink
export PATH=$HADOOP_HOME/bin:$PYTHON_HOME:$JAVA_HOME/bin:$HIVE_HOME/bin:$PATH:$PATH
将jdk软链到/usr/bin/java下(仍以 JAVA_HOME=/opt/soft/java 为例)
sudo ln -s /usr/java/jdk1.8.0_181bin/java /usr/bin/java
修改一键启动的参数
修改一键部署配置文件 conf/config/install_config.conf中的各参数,特别注意以下参数的配置
copy xml到mkdir /opt/dolphinscheduler/conf/
mkdir /opt/dolphinscheduler/conf/
[root@ifeng01 hadoop]# cp core-site.xml /opt/dolphinscheduler/conf/
[root@ifeng01 hadoop]# cp hdfs-site.xml /opt/dolphinscheduler/conf/
chown -R dolphinscheduler:dolphinscheduler 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.
#
# NOTICE : If the following config has special characters in the variable `.*[]^${}\+?|()@#&`, Please escape, for example, `[` escape to `\[`
# postgresql or mysql
dbtype="mysql"
# db config
# db address and port
dbhost="10.2.0.6:3306"
# db username
username="dolphinscheduler"
# database name
dbname="dolphinscheduler"
# db passwprd
# NOTICE: if there are special characters, please use the \ to escape, for example, `[` escape to `\[`
password="123"
# zk cluster
zkQuorum="10.2.0.6:2181,10.2.0.7:2181,10.2.0.8:2181"
# Note: the target installation path for dolphinscheduler, please not config as the same as the current path (pwd)
installPath="/data00/dolphinscheduler"
# deployment user
# Note: the deployment user needs to have sudo privileges and permissions to operate hdfs. If hdfs is enabled, the root directory needs to be created by itself
deployUser="dolphinscheduler"
# alert config
# mail server host
mailServerHost="apsmtp.lenovo.com"
# mail server port
# note: Different protocols and encryption methods correspond to different ports, when SSL/TLS is enabled, make sure the port is correct.
mailServerPort="25"
# sender
mailSender="spi@lenovo.com"
# user
mailUser="spi@lenovo.com"
# sender password
# note: The mail.passwd is email service authorization code, not the email login password.
mailPassword="Work3fun"
# TLS mail protocol support
starttlsEnable="true"
# SSL mail protocol support
# only one of TLS and SSL can be in the true state.
sslEnable="false"
#note: sslTrust is the same as mailServerHost
#sslTrust="smtp.exmail.qq.com"
# resource storage type:HDFS,S3,NONE
resourceStorageType="HDFS"
# 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://10.2.0.6:9870"
# if resourcemanager HA enable, please type the HA ips ; if resourcemanager is single, make this value empty
yarnHaIps=""
# if resourcemanager HA enable or not use resourcemanager, please skip this value setting; If resourcemanager is single, you only need to replace yarnIp1 to actual resourcemanager hostname.
singleYarnIp="ifeng01"
# resource store on HDFS/S3 path, resource file will store to this hadoop hdfs path, self configuration, please make sure the directory exists on hdfs and have read write permissions。/dolphinscheduler is recommended
resourceUploadPath="/data00/ds"
# who have permissions 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
keytabUserName="hdfs-mycluster@ESZ.COM"
# username keytab path
keytabPath="$installPath/conf/hdfs.headless.keytab"
# api server port
apiServerPort="12345"
# install hosts
# Note: install the scheduled hostname list. If it is pseudo-distributed, just write a pseudo-distributed hostname
ips="ifeng01,ifeng02,ifeng03"
# ssh port, default 22
# Note: if ssh port is not default, modify here
sshPort="22"
# run master machine
# Note: list of hosts hostname for deploying master
masters="ifeng01"
# run worker machine
# note: need to write the worker group name of each worker, the default value is "default"
workers="ifeng01:default,ifeng02:default,ifeng03:default"
# run alert machine
# note: list of machine hostnames for deploying alert server
alertServer="ifeng03"
# run api machine
# note: list of machine hostnames for deploying api server
apiServers="ifeng01"
7 初始化
sh install.sh
日志目录
8 启停服务
一键停止集群所有服务
sh ./bin/stop-all.sh
一键开启集群所有服务
sh ./bin/start-all.sh
启停Master
sh ./bin/dolphinscheduler-daemon.sh start master-server
sh ./bin/dolphinscheduler-daemon.sh stop master-server
启停Worker
sh ./bin/dolphinscheduler-daemon.sh start worker-server
sh ./bin/dolphinscheduler-daemon.sh stop worker-server
启停Api
sh ./bin/dolphinscheduler-daemon.sh start api-server
sh ./bin/dolphinscheduler-daemon.sh stop api-server
启停Logger
sh ./bin/dolphinscheduler-daemon.sh start logger-server
sh ./bin/dolphinscheduler-daemon.sh stop logger-server
启停Alert
sh ./bin/dolphinscheduler-daemon.sh start alert-server
sh ./bin/dolphinscheduler-daemon.sh stop alert-server
9 常规填坑
9.1 创建租户失败
直接用admin用户在资源中心创建文件夹 会提示 创建资源错误
提示NullPointerException , 空指针
原因
默认的admin租户为空
首先应该创建一个租户 把admin的租户改为刚才创建的
再次创建文件夹
9.2 警告邮件
9.2.1 SMTP
1.3.1 /opt/dolphinscheduler/dolphinscheduler-bin/conf/config/install_config.conf
中移除了
mailProtocol="SMTP"
需要手动添加
TLS 和 SSL都设置为false即可
# TLS mail protocol support
starttlsEnable="false"
# SSL mail protocol support
# only one of TLS and SSL can be in the true state.
sslEnable="false"
9.2.2 通知组
通知组不能留空
否则会出现NPE