1、DolphinScheduler简介
-
Apache DolphinScheduler](https://dolphinscheduler.apache.org/)(目前处在孵化阶段)是一个分布式、去中心化、易扩展的可视化DAG工作流任务调度系统,
其致力于解决数据处理流程中错综复杂的依赖关系,使调度系统在数据处理流程中开箱即用。 -
DolphinScheduler是2019年中国易观公司开源的一个调度系统,在美国时间2019年8月29号,易观开源的分布式任务调度引擎DolphinScheduler(原EasyScheduler)
正式通过顶级开源组织Apache基金会的投票决议,根据Apache基金会邮件列表显示,在包含11个约束性投票(binding votes)和2个无约束性投票(non-binding votes)的
投票全部持赞同意见,无弃权票和反对票,投票顺利通过,这样便以全票通过的优秀表现正式成为了Apache孵化器项目!
2、DolphinScheduler的特性
2.1 高可靠性
- 去中心化多Master和Worker,自身支持HA功能,采用任务队列来避免过载,不会造成机器卡死
2.2.简单易用
- DAG监控界面,所有流程定义都是可视化,通过拖拽任务制定DAG
- 通过API方式与第三方系统对接,一键部署。
2.3.丰富的使用场景
- 支持暂停、恢复操作,支持多租户,更好的应对大数据的使用场景,支持更多的任务类型,如hive,mr,spark,python
2.4.高扩展性
- 支持自定义任务类型,调度器使用分布式调度,调度能力随集群线性增长,Master和Worker支持动态上下线
3、DolphinScheduler的架构介绍
3.1 系统架构设计
https://dolphinscheduler.apache.org/zh-cn/blog/architecture-design.html
3.2 DS-1.3改进及新特性
- 数据库减压,减少极端情况下的可能造成的调度延时
- Worker去DB、职责更单一
- Master和Worker直接通信,降低 延时
- Master多种策略分发任务(有三种方式选择Worker节点:随机、循环、CPU和 内存的线性加权负载平衡 )
- 资源中心支持多目录
- 任务类型新增Datax、 Sqoop、条件分支
- DAG一键格式化
- 批量导出和导入工作流
- 工作流复制
3.3 DS-1.3系统架构图
Dolphinscheduler安装部署
官方安装指导:https://dolphinscheduler.apache.org/zh-cn/docs/1.3.4/user_doc/quick-start.html
1节点规划
机器 | 服务 | 端口 | group |
---|---|---|---|
hadoop01 | master、api、logger | 8787(master)、8888(api) | |
hadoop02 | master、alert、worker、logger | 8787(master)、7878(worker) | hadoop |
hadoop03 | worker、logger | 7878(worker) | hadoop |
hadoop 组配置后master分发任务才能根据cpu和内存的负载选择具体哪个worker执行任务
2 准备工作
1、创建目录
- 确保三个节点都有目录
/bigdata/soft
、/bigdata/install
,且所属用户及用户组如下
[hadoop@hadoop01 ~]$ ll /bigdata/
总用量 0
drwxr-xr-x. 2 hadoop hadoop 6 4月 13 14:21 install
drwxr-xr-x. 2 hadoop hadoop 6 4月 13 14:22 soft
- 若没有这些目录,那么如下创建;3个节点都运行如下命令
sudo mkdir -p /bigdata/install
sudo mkdir -p /bigdata/soft
sudo chown -R hadoop:hadoop /bigdata/
ll /bigdata/
2、确保已安装zookeeper集群
- 启动zookeeper集群
- 确保三节点上已经安装了zk
- zk版本要求:ZooKeeper (3.4.6+)
- 若没有安装,请先安装再往下继续
3、启动HDFS
- 因为ds的资源存储在HDFS上
- 所以,hadoop01上运行
start-dfs.sh
启动hdfs
3 开始安装
第一步:安装包下载,在hadoop01上执行
[hadoop@hadoop01~]$ cd /bigdata/soft/
[hadoop@hadoop01 soft]$ wget https://mirrors.tuna.tsinghua.edu.cn/apache/incubator/dolphinscheduler/1.3.5/apache-dolphinscheduler-incubating-1.3.5-dolphinscheduler-bin.tar.gz
第二步:解压压缩包
[hadoop@hadoop01 soft]$ tar -xzvf apache-dolphinscheduler-incubating-1.3.5-dolphinscheduler-bin.tar.gz -C /bigdata/install/
第三步:重命名
[hadoop@hadoop01 soft]$ cd /bigdata/install/
[hadoop@hadoop01 install]$ mv apache-dolphinscheduler-incubating-1.3.5-dolphinscheduler-bin/ dolphinscheduler-1.3.5
[hadoop@hadoop01 install]$ ll
总用量 0
drwxrwxr-x. 9 hadoop hadoop 156 4月 13 14:35 dolphinscheduler-1.3.5
第四步:建库建表
此处以hadoop03安装了mysql为例
hadoop01上
[hadoop@hadoop01 install]$ scp /bigdata/install/dolphinscheduler-1.3.5/sql/dolphinscheduler_mysql.sql hadoop03:/bigdata/soft/
hadoop03上,进入MySQL命令行执行
mysql -uroot -p
set global validate_password_policy=LOW;
set global validate_password_length=6;
CREATE DATABASE IF NOT EXISTS dolphinscheduler DEFAULT CHARSET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'root'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'root'@'localhost' IDENTIFIED BY '123456';
flush privileges;
use dolphinscheduler;
source /kkb/soft/dolphinscheduler_mysql.sql;
mysql> show tables;
+--------------------------------+
| Tables_in_dolphinscheduler |
+--------------------------------+
| QRTZ_BLOB_TRIGGERS |
| QRTZ_CALENDARS |
| QRTZ_CRON_TRIGGERS |
| QRTZ_FIRED_TRIGGERS|
| QRTZ_JOB_DETAILS |
| QRTZ_LOCKS |
| QRTZ_PAUSED_TRIGGER_GRPS |
| QRTZ_SCHEDULER_STATE |
| QRTZ_SIMPLE_TRIGGERS |
| QRTZ_SIMPROP_TRIGGERS |
| QRTZ_TRIGGERS |
| t_ds_access_token |
| t_ds_alert |
| t_ds_alertgroup|
| t_ds_command |
| t_ds_datasource|
| t_ds_error_command |
| t_ds_process_definition|
| t_ds_process_instance |
| t_ds_project |
| t_ds_queue |
| t_ds_relation_datasource_user |
| t_ds_relation_process_instance |
| t_ds_relation_project_user |
| t_ds_relation_resources_user |
| t_ds_relation_udfs_user|
| t_ds_relation_user_alertgroup |
| t_ds_resources |
| t_ds_schedules |
| t_ds_session |
| t_ds_task_instance |
| t_ds_tenant|
| t_ds_udfs |
| t_ds_user |
| t_ds_version |
+--------------------------------+
35 rows in set (0.00 sec)
第五步:修改配置文件
[hadoop@hadoop01 ~]$ cd /bigdata/install/dolphinscheduler-1.3.5/conf/
1、alert.properties
配置告警邮箱相关信息
- 此处已126邮箱为例
- 登录自己的126邮箱
- 开始配置文件
[hadoop@hadoop01 conf]$ vim alert.properties
#alert type is EMAIL/SMS
alert.type=EMAIL
# mail server configuration
mail.protocol=SMTP
mail.server.host=smtp.126.com
mail.server.port=25
mail.sender=youhy964@126.com
mail.user=youhy964@126.com
mail.passwd=WBNPUGCNZMQQYBUT
# TLS
mail.smtp.starttls.enable=true
# SSL
mail.smtp.ssl.enable=false
mail.smtp.ssl.trust=smtp.126.com
2、application-api.properties
- 修改web ui端口号
[hadoop@hadoop01 conf]$ vim application-api.properties
# server port
server.port=8888
3、common.properties
# 修改如下3个属性的值
[hadoop@hadoop01 conf]$ vim common.properties
resource.storage.type=HDFS
fs.defaultFS=hdfs://hadoop01:8020
yarn.application.status.address=http://hadoop01:8088/ws/v1/cluster/apps/%s
4、datasource.properties
假设mysql安装在hadoop03节点
# 修改如下几个属性的值
[hadoop@hadoop01 conf]$ vim datasource.properties
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://hadoop03:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
spring.datasource.username=root
spring.datasource.password=123456
5、master.properties
[hadoop@hadoop01 conf]$ vim master.properties
master.listen.port=8787
6、worker.properties
[hadoop@hadoop01 conf]$ vim worker.properties
worker.listen.port=7878
worker.groups=hadoop
7、zookeeper.properties
[hadoop@hadoop01 conf]$ vim zookeeper.properties
zookeeper.quorum=hadoop01:2181,hadoop02:2181,hadoop03:2181
8、env/dolphinscheduler_env.sh
# 修改如下属性,根据自己的实际情况,配置属性值 |
[hadoop@hadoop01 conf]$ vim env/dolphinscheduler_env.sh
export HADOOP_HOME=/bigdata/install/hadoop-3.1.4
export HADOOP_CONF_DIR=/bigdata/install/hadoop-3.1.4/etc/hadoop
export SPARK_HOME1=/bigdata/install/spark-2.3.3-bin-hadoop2.7
export JAVA_HOME=/bigdata/install/jdk1.8.0_141
export HIVE_HOME=/bigdata/install/hive-3.1.2
第六步:将hdfs-site.xml、core-site.xml 拷贝至ds的 conf 目录下,同时 把mysql-connector-java-5.1.48-bin.jar驱动包上传到ds的lib目录下
[hadoop@hadoop01 conf]$ cp /bigdata/install/hadoop-3.1.4/etc/hadoop/hdfs-site.xml /bigdata/install/dolphinscheduler-1.3.5/conf
[hadoop@hadoop01 conf]$ cp /bigdata/install/hadoop-3.1.4/etc/hadoop/core-site.xml /bigdata/install/dolphinscheduler-1.3.5/conf
# 将mysql-connector-java-5.1.38.jar上传到hadoop01的/bigdata/soft目录
[hadoop@hadoop01 soft]$ cd /bigdata/soft/
[hadoop@hadoop01 soft]$ cp mysql-connector-java-5.1.38.jar /bigdata/install/dolphinscheduler-1.3.5/lib/
第七步:到ds的bin目录下(1.3.5版本,可以跳过此步)
dos2unix dolphinscheduler-daemon.sh #dos2unix:将DOS格式的文本文件转换成UNIX格式的(DOS/MAC to UNIX text file format converter)
chmod +x dolphinscheduler-daemon.sh
第八步:scp到hadoop02、hadoop03
[hadoop@hadoop01 bin]$ cd /bigdata/install/
[hadoop@hadoop01 install]$ scp -r dolphinscheduler-1.3.5/ hadoop02:$PWD
[hadoop@hadoop01 install]$ scp -r dolphinscheduler-1.3.5/ hadoop03:$PWD
4 调优配置
生产环境上建议,worker.properties里设置的cpu和内存调一下就可以保护worker不至于挂掉,一般别超过cpu核数的2倍,内存留上1~2G(当然如果比较豪,可以预留更多资源),线程数别超过cp倍。
例如:8c16G机器 worker.exec.threads=20 worker.max.cpuload.avg=16 worker.reserved.memory=1
同理对于master调优配置 8c16G机器 master.properties文件 master.max.cpuload.avg=16 master.reserved.memory=1
5 启动
在hadoop01 启动 master、api、logger
[hadoop@hadoop01 ~]$ cd /bigdata/install/dolphinscheduler-1.3.5/bin/
[hadoop@hadoop01 bin]$ ./dolphinscheduler-daemon.sh start master-server
[hadoop@hadoop01 bin]$ ./dolphinscheduler-daemon.sh start api-server
[hadoop@hadoop01 bin]$ ./dolphinscheduler-daemon.sh start logger-server
在hadoop02 启动 master、alert、worker、logger
[hadoop@hadoop02 ~]$ cd /bigdata/install/dolphinscheduler-1.3.5/bin/
[hadoop@hadoop02 bin]$ ./dolphinscheduler-daemon.sh start master-server
[hadoop@hadoop02 bin]$ ./dolphinscheduler-daemon.sh start alert-server
[hadoop@hadoop02 bin]$ ./dolphinscheduler-daemon.sh start worker-server
[hadoop@hadoop02 bin]$ ./dolphinscheduler-daemon.sh start logger-server
在hadoop03 启动 worker、logger
[hadoop@hadoop03 ~]$ cd /bigdata/install/dolphinscheduler-1.3.5/bin/
[hadoop@hadoop03 bin]$ ./dolphinscheduler-daemon.sh start worker-server
[hadoop@hadoop03 bin]$ ./dolphinscheduler-daemon.sh start logger-server
目前3节点已经启动了hadoop集群、zookeeper集群、及ds相关进程;
启动成功之后,会出现如下进程
[hadoop@hadoop01 bin]$ xcall jps
============= hadoop01 jps =============
3680 ApiApplicationServer
2465 DataNode
3761 LoggerServer
3410 JobHistoryServer
2036 QuorumPeerMain
2294 NameNode
3607 MasterServer
2666 SecondaryNameNode
2892 ResourceManager
3037 NodeManager
4351 Jps
============= hadoop02 jps =============
2320 NodeManager
2880 LoggerServer
2179 DataNode
3446 Jps
3287 AlertServer
2616 MasterServer
2798 WorkerServer
2031 QuorumPeerMain
============= hadoop03 jps =============
2160 DataNode
2289 NodeManager
3009 LoggerServer
1996 QuorumPeerMain
2927 WorkerServer
3103 Jps
- 如何关闭ds集群?
- 关闭个节点的各角色,就是将上边启动命令中的start换成stop即可
[hadoop@hadoop01 ~]$ cd /bigdata/install/dolphinscheduler-1.3.5/bin/
[hadoop@hadoop01 bin]$ ./dolphinscheduler-daemon.sh stop master-server
[hadoop@hadoop01 bin]$ ./dolphinscheduler-daemon.sh stop api-server
[hadoop@hadoop01 bin]$ ./dolphinscheduler-daemon.sh stop logger-server
[hadoop@hadoop02 ~]$ cd /bigdata/install/dolphinscheduler-1.3.5/bin/
[hadoop@hadoop02 bin]$ ./dolphinscheduler-daemon.sh stop master-server
[hadoop@hadoop02 bin]$ ./dolphinscheduler-daemon.sh stop alert-server
[hadoop@hadoop02 bin]$ ./dolphinscheduler-daemon.sh stop worker-server
[hadoop@hadoop02 bin]$ ./dolphinscheduler-daemon.sh stop logger-server
[hadoop@hadoop03 ~]$ cd /bigdata/install/dolphinscheduler-1.3.5/bin/
[hadoop@hadoop03 bin]$ ./dolphinscheduler-daemon.sh stop worker-server
[hadoop@hadoop03 bin]$ ./dolphinscheduler-daemon.sh stop logger-server
6 访问验证
web页面
-
访问地址:http://hadoop01:8888/dolphinscheduler/ui/view/login/index.html
-
默认用户:admin
-
默认密码:dolphinscheduler123