上一篇文章《分布式调度系统Apache DolphinScheduler系列(一)DolphinScheduler介绍》我们做了一个初步的介绍。在Apache DolphinScheduler的官网里面,介绍了好几种部署方式,有:
单机部署: 适合快速上手的学习阶段 伪集群部署: 适合学习阶段,有完整的功能 集群部署: 适合生产环境使用 Kubernetes部署: 适合生产环境使用
这里呢,我们为了演示效果,因此使用伪集群的方式来进行后面的演示。在真实的环境中,一定建议大家使用集群部署和Kubernetes部署方式。下面直接开始进行伪集群部署的安装。
一、准备jdk环境
这里的jdk我们使用jdk1.8。如下图:
二、准备一个mysql5.7环境
这里的话,我们需要把DolphinScheduler的配置存储在外部的mysql上,因此我们需要准备一个mysql5.7版本的数据库,并且创建一个scheduler的库。
三、配置ssh免密码登录
这里的话,我们需要配置下ssh免密码登录,这里不过多介绍,可以参考这篇文章《linux服务器如何快速配置ssh免密码登录?》。
四、安装psmisc
DolphinScheduler这个系统里面会涉及到调用psmisc,因此对于linux来说,我们需要安装一个psmisc。这里linux安装比较简单,直接执行下面的命令即可:
yum install -y psmisc
五、安装zookeeper
这里我们还需要安装一个zookeeper。这里可以参考这篇文章《docker-compose配置zookeeper启动》。这里我们已经启动完成了。
六、下载DolphinScheduler
这里我们去官网下载一个最新版本的DolphinScheduler。官网下载地址是:官网下载。这里我们下载的版本是3.1.4版本
下载后把他上传到服务器上。
七、安装DolphinScheduler
这里由于是伪集群安装,因此我们这里的话,安装的角色规划如下:
序号 | 角色 | 地址 |
1 | master | 192.168.31.20 |
2 | worker | 192.168.31.20 |
3 | alterServer | 192.168.31.20 |
4 | apiServer | 192.168.31.20 |
1)这里我们首先配置mysql信息,首先下载mysql-connector-java驱动,下载地址是:mysql驱动下载。下载的时候注意选项,如下图:
这里的版本的话,选择8.0.16(这是官网备注的下载版本)。下载之后,解压就能看到mysql-connector的包
然后我们把这个mysql-connector的包放到如下的目录里面去:
${DolphinScheduler_home}/api-server/libs/ ${DolphinScheduler_home}/alert-server/libs/ ${DolphinScheduler_home}/master-server/libs/ ${DolphinScheduler_home}/worker-server/libs/ ${DolphinScheduler_home}/tools/libs/
然后我们修改DolphinScheduler的数据库配置文件,对应的文件是:${DolphinScheduler_home}/bin/env/dolphinscheduler_env.sh。这里我们修改如下的信息即可。
# Database related configuration, set database type, username and password export DATABASE=${DATABASE:-mysql} export SPRING_PROFILES_ACTIVE=${DATABASE} export SPRING_DATASOURCE_URL="jdbc:mysql://192.168.31.30:3306/scheduler?useUnicode=true&characterEncoding=UTF-8&useSSL=false" export SPRING_DATASOURCE_USERNAME="scheduler" export SPRING_DATASOURCE_PASSWORD="YmBDpz775TeWT6r2"
修改完成之后,如下图:
然后我们执行数据库的初始化数据
#进入到${DolphinScheduler_home}/tools/bin cd /mmt/apache-dolphinscheduler-3.1.4-bin/tools/bin #执行初始化数据库的语句 sh upgrade-schema.sh
执行之后就可以看到在初始化数据表了。
当出现如下界面的时候就代表初始化数据库完成了
然后我们使用navicat查看下数据库的表信息
可以看到这里的表都已经初始化到数据库中了。
2)修改DolphinScheduler配置
首先我们修改${DolphinScheduler_home}/bin/env文件夹下的install_env.sh文件,这里我们需要定义下我们节点的信息,修改信息如下:
# # 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="10.206.0.9" # 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="10.206.0.9" # 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="10.206.0.9" # 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="10.206.0.9" # 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="10.206.0.9" # 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). Do not add quotes to it if you using related path. installPath=${installPath:-"/tmp/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=${deployUser:-"root"} # The root of zookeeper, for now DolphinScheduler default registry server is zookeeper. zkRoot=${zkRoot:-"/dolphinscheduler"}
修改上面几个属性,把他修改为对应的单机ip即可。同时需要修改下部署用户,这个用户必须要有root权限。
接着我们修改${DolphinScheduler_home}/bin/env文件夹下的dolphinscheduler_env.sh文件,我这里修改后的完整文件内容是:
# # 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. # # JAVA_HOME, will use it to start DolphinScheduler server export JAVA_HOME=${JAVA_HOME:-/usr/local/jdk1.8.0_202/} # Database related configuration, set database type, username and password export DATABASE=${DATABASE:-mysql} export SPRING_PROFILES_ACTIVE=${DATABASE} export SPRING_DATASOURCE_URL="jdbc:mysql://192.168.31.30:3306/scheduler?useUnicode=true&characterEncoding=UTF-8&useSSL=false" export SPRING_DATASOURCE_USERNAME="scheduler" export SPRING_DATASOURCE_PASSWORD="YmBDpz775TeWT6r2" # 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} # Registry center configuration, determines the type and link of the registry center export REGISTRY_TYPE=${REGISTRY_TYPE:-zookeeper} export REGISTRY_ZOOKEEPER_CONNECT_STRING="192.168.31.20:2181" # Tasks related configurations, need to change the configuration if you use the related tasks. export HADOOP_HOME=${HADOOP_HOME:-/opt/soft/hadoop} export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-/opt/soft/hadoop/etc/hadoop} export SPARK_HOME1=${SPARK_HOME1:-/opt/soft/spark1} export SPARK_HOME2=${SPARK_HOME2:-/opt/soft/spark2} export PYTHON_HOME=${PYTHON_HOME:-/opt/soft/python} export HIVE_HOME=${HIVE_HOME:-/opt/soft/hive} export FLINK_HOME=${FLINK_HOME:-/opt/soft/flink} export DATAX_HOME=${DATAX_HOME:-/opt/soft/datax} export SEATUNNEL_HOME=${SEATUNNEL_HOME:-/opt/soft/seatunnel} export CHUNJUN_HOME=${CHUNJUN_HOME:-/opt/soft/chunjun} export PATH=$HADOOP_HOME/bin:$SPARK_HOME1/bin:$SPARK_HOME2/bin:$PYTHON_HOME/bin:$JAVA_HOME/bin:$HIVE_HOME/bin:$FLINK_HOME/bin:$DATAX_HOME/bin:$SEATUNNEL_HOME/bin:$CHUNJUN_HOME/bin:$PATH
这里其实我们在初始化数据库的时候已经修改过了,剩下的这里主要是修改下zookeeper的信息即可。同时这里的hadoop等信息暂时不需要修改,等到使用的时候再进行修改即可。还有一点,这里的jdk需要切换成服务器上jdk的路径,不然的话,会报错找不到jdk
3)然后我们进入到bin目录,执行install命令
#进入到${DolphinScheduler_home}/bin cd /mmt/apache-dolphinscheduler-3.1.4-bin/bin #执行安装命令 ./install.sh
这时候的安装图如下:
这里在执行install命令的时候执行时间会比较长,稍微等待一下即可。这里的安装其实是把主要的文件拷贝到我们在${DolphinScheduler_home}/bin/env/install_env.sh文件的这个配置里面:
installPath=${installPath:-"/tmp/dolphinscheduler"}
后期我们在启动、停止等操作的时候,就操作这个文件夹下的安装文件。
安装完成之后,日志记录会如下图:
可以看到这几个进程都启动起来了,此时我们使用jsp查看下:
到这里就说明这里的Apache DolphinScheduler就安装完毕了,此时我们访问下: http://${ip}:12345//dolphinscheduler/ui 就可以看到登录界面了。
这里默认的登录账号密码是:
登录账号:admin 登录密码:dolphinscheduler123
登录后我们就能看到对应的dashboard界面了。
还没有评论,来说两句吧...