dolphinscheduler最新版2.0.2+mysql8.0.16部署(一)

1. 下載dolphinscheduler

下載地址https://dolphinscheduler.apache.org/en-us/download/download.html

下載版本爲:wps79CF.tmp_thumb[2]src源碼,需要重新編譯

查看pom.xml對應的組件版本,這裏不介紹編譯方式,下次用到介紹

<curator.version>4.3.0</curator.version>

<zookeeper.version>3.4.14</zookeeper.version>

<spring.version>5.3.12</spring.version>

<spring.boot.version>2.5.6</spring.boot.version>

<java.version>1.8</java.version>

<logback.version>1.2.3</logback.version>

<hadoop.version>2.7.3</hadoop.version>

<quartz.version>2.3.0</quartz.version>

<jackson.version>2.10.5</jackson.version>

<mybatis-plus.version>3.2.0</mybatis-plus.version>

<mybatis.spring.version>2.0.1</mybatis.spring.version>

<cron.utils.version>9.1.3</cron.utils.version>

<druid.version>1.2.4</druid.version>

<h2.version>1.4.200</h2.version>

<commons.codec.version>1.11</commons.codec.version>

<commons.logging.version>1.1.1</commons.logging.version>

<httpclient.version>4.4.1</httpclient.version>

<httpcore.version>4.4.1</httpcore.version>

<junit.version>4.12</junit.version>

<mysql.connector.version>8.0.16</mysql.connector.version>

<slf4j.api.version>1.7.5</slf4j.api.version>

<slf4j.log4j12.version>1.7.5</slf4j.log4j12.version>

<commons.collections.version>3.2.2</commons.collections.version>

<commons.httpclient>3.0.1</commons.httpclient>

<commons.beanutils.version>1.9.4</commons.beanutils.version>

<commons.configuration.version>1.10</commons.configuration.version>

<commons.lang.version>2.6</commons.lang.version>

<commons.email.version>1.5</commons.email.version>

<poi.version>4.1.2</poi.version>

<javax.servlet.api.version>3.1.0</javax.servlet.api.version>

<commons.collections4.version>4.1</commons.collections4.version>

<guava.version>24.1-jre</guava.version>

<postgresql.version>42.2.5</postgresql.version>

<hive.jdbc.version>2.1.0</hive.jdbc.version>

<commons.io.version>2.4</commons.io.version>

<oshi.core.version>3.9.1</oshi.core.version>

<clickhouse.jdbc.version>0.1.52</clickhouse.jdbc.version>

<mssql.jdbc.version>6.1.0.jre8</mssql.jdbc.version>

<presto.jdbc.version>0.238.1</presto.jdbc.version>

<spotbugs.version>3.1.12</spotbugs.version>

<checkstyle.version>3.1.2</checkstyle.version>

<zookeeper.version>3.4.14</zookeeper.version>

<curator.test>2.12.0</curator.test>

<frontend-maven-plugin.version>1.6</frontend-maven-plugin.version>

<maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>

<maven-assembly-plugin.version>3.1.0</maven-assembly-plugin.version>

<maven-release-plugin.version>2.5.3</maven-release-plugin.version>

<maven-javadoc-plugin.version>2.10.3</maven-javadoc-plugin.version>

<maven-source-plugin.version>2.4</maven-source-plugin.version>

<maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>

<maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version>

<rpm-maven-plugion.version>2.2.0</rpm-maven-plugion.version>

<jacoco.version>0.8.4</jacoco.version>

<jcip.version>1.0</jcip.version>

<maven.deploy.skip>false</maven.deploy.skip>

<cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version>

<mockito.version>2.21.0</mockito.version>

<powermock.version>2.0.2</powermock.version>

<servlet-api.version>2.5</servlet-api.version>

<swagger.version>1.9.3</swagger.version>

<springfox.version>2.9.2</springfox.version>

<swagger-models.version>1.5.24</swagger-models.version>

<guava-retry.version>2.0.0</guava-retry.version>

<protostuff.version>1.7.2</protostuff.version>

<reflections.version>0.9.12</reflections.version>

<byte-buddy.version>1.9.16</byte-buddy.version>

<java-websocket.version>1.5.1</java-websocket.version>

<py4j.version>0.10.9</py4j.version>

<auto-service.version>1.0.1</auto-service.version>

<jacoco.skip>false</jacoco.skip>

<netty.version>4.1.53.Final</netty.version>

<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>

2. 創建應用用戶及免密

以dolphin-server爲server機,以下需要在每臺機器創建用戶

# 創建用戶需使用root登錄,設置部署用戶名,請自行修改,後面以dolphinscheduler爲例

useradd dolphin;

# 設置用戶密碼,請自行修改,後面以dolphinscheduler123爲例

echo "dolphin" | passwd --stdin dolphin

# 配置sudo免密

echo 'dolphin  ALL=(ALL)  NOPASSWD: NOPASSWD: ALL' >> /etc/sudoers

在84機器上執行

#add ip hostname

vi /etc/hosts

198.28.1.82 ht-28-tdh82

198.28.1.83 ht-28-tdh83

198.28.1.84 ht-28-tdh84

#同步dolphin-server上的/etc/hosts到所有部署機器

for ip in dolphin-82 dolphin-83;    

do

sudo scp -r /etc/hosts  $ip:/etc/          #在運行中需要輸入root密碼

done

#在dolphin-84上,切換到部署用戶並配置ssh本機免密登錄

su - dolphin;

ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

chmod 600 ~/.ssh/authorized_keys

for ip in ht-28-tdh82 ht-28-tdh83;     #請將此處ds2 ds3替換爲自己要部署的機器的hostname

do

ssh-copy-id  $ip   #該操作執行過程中需要手動輸入dolphinscheduler用戶的密碼

done

3. Mysql部署

下載mysql 版本 (mysql-8.0.16-linux-glibc2.12-x86_64.tar)

wps79E0.tmp_thumb[1]

cd /opt/dolphin

tar -xvf mysql-8.0.16-linux-glibc2.12-x86_64.tar

tar -xvJf mysql-8.0.16-linux-glibc2.12-x86_64.tar.xz

# 建立軟鏈接,便於以後版本升級

ln -s mysql-8.0.16-linux-glibc2.12-x86_64 mysql

創建臨時目錄、數據目錄和日誌目錄

mkdir -p /opt/dolphin/mysql/3306/data

mkdir -p /opt/dolphin/mysql/3306/log

mkdir -p /opt/dolphin/mysql/3306/tmp

# 創建配置文件-root下

cd /etc

# 在my.cnf文件中添加對應的配置項

cp my.cnf my.cnf.bak20220125
vi my.cnf

[client] # 客戶端設置,即客戶端默認的連接參數

port = 3306 # 默認連接端口

socket = /opt/dolphin/mysql/3306/tmp/mysql.sock # 用於本地連接的socket套接字,mysqld守護進程生成了這個文件

[mysqld] # 服務端基本設置

# 基礎設置

server-id = 1 # Mysql服務的唯一編號 每個mysql服務Id需唯一

port = 3306 # MySQL監聽端口

basedir = /opt/dolphin/mysql # MySQL安裝根目錄

datadir = /opt/dolphin/mysql/3306/data # MySQL數據文件所在位置

tmpdir = /opt/dolphin/mysql/3306/tmp # 臨時目錄,比如load data infile會用到

socket = /opt/dolphin/mysql/3306/tmp/mysql.sock # 爲MySQL客戶端程序和服務器之間的本地通訊指定一個套接字文件

pid-file = /opt/dolphin/mysql/3306/log/mysql.pid # pid文件所在目錄

#skip_name_resolve = 1 # 只能用IP地址檢查客戶端的登錄,不用主機名

character-set-server = utf8mb4 # 數據庫默認字符集,主流字符集支持一些特殊表情符號(特殊表情符佔用4個字節)

transaction_isolation = READ-COMMITTED # 事務隔離級別,默認爲可重複讀,MySQL默認可重複讀級別

collation-server = utf8mb4_general_ci # 數據庫字符集對應一些排序等規則,注意要和character-set-server對應

init_connect='SET NAMES utf8mb4' # 設置client連接mysql時的字符集,防止亂碼

lower_case_table_names = 1 # 是否對sql語句大小寫敏感,1表示不敏感

max_connections = 400 # 最大連接數

max_connect_errors = 1000 # 最大錯誤連接數

explicit_defaults_for_timestamp = true # TIMESTAMP如果沒有顯示聲明NOT NULL,允許NULL值

max_allowed_packet = 128M # SQL數據包發送的大小,如果有BLOB對象建議修改成1G

interactive_timeout = 1800 # MySQL連接閒置超過一定時間後(單位:秒)將會被強行關閉

wait_timeout = 1800 # MySQL默認的wait_timeout值爲8個小時, interactive_timeout參數需要同時配置才能生效

tmp_table_size = 16M # 內部內存臨時表的最大值 ,設置成128M;比如大數據量的group by ,order by時可能用到臨時表;超過了這個值將寫入磁盤,系統IO壓力增大

安裝MySQL數據庫

# 進入MySQL的bin目錄

cd /opt/dolphin/mysql/bin

# 初始化數據庫,並指定啓動mysql的用戶

./mysqld --initialize --user=dolphin

生成隨機密碼

root@localhost: ,8v_<fe;,.cP

設置開機自啓動服務

# 複製啓動腳本到資源目錄

cp /opt/dolphin/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld

# 增加mysqld服務控制腳本執行權限

chmod +x /etc/rc.d/init.d/mysqld

# 將mysqld服務加入到系統服務

chkconfig --add mysqld

# 檢查mysqld服務是否已經生效

chkconfig --list mysqld

# 切換至mysql用戶,啓動mysql

su - dolphin

service mysqld start

wps79E1.tmp_thumb[1]

配置環境變量

# 修改配置文件,增加

cp .bash_profile .bash_profile_bak20220125

vi .bash_profile

export PATH=$PATH:/opt/dolphin/mysql/bin

# 立即生效

source .bash_profile

登陸,修改密碼

# 登陸mysql

./mysql -uroot -p -S/opt/dolphin/mysql/3306/tmp/mysql.sock

報錯:ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

修改

vi /etc/my.cnf

[mysqld]

default_authentication_plugin=mysql_native_password

重啓mysql

service mysqld restart

# 修改root用戶密碼

alter user 'root'@'localhost'IDENTIFIED BY '123456';

4. 數據庫初始化

· 進入數據庫,默認數據庫是PostgreSQL,如選擇Mysql的話,後續需要添加mysql-connector-java驅動包到DolphinScheduler的lib目錄下,這裏以mysql爲例

mysql -uroot -p

· 進入數據庫命令行窗口後,執行數據庫初始化命令,設置訪問賬號和密碼。

mysql> CREATE DATABASE dolphinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

Query OK, 1 row affected (0.00 sec)

mysql> create user 'dolphin'@'localhost' identified by 'dolphin';

mysql> GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'dolphin'@'localhost';

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

5. Ds部署

root下面創建目錄

mkdir -p /opt/dolphin;

賦權

chown -R dolphin:dolphin /opt/dolphin

cd /opt/dolphin;

tar -zxvf apache-dolphinscheduler-2.0.2-bin.tar.gz -C /opt/dolphin;

#在ds1上,修改目錄權限,使得部署用戶對dolphin-backend目錄有操作權限

chown -R dolphin:dolphin apache-dolphinscheduler-2.0.2-bin

· 修改 conf 目錄下 application-mysql.yaml 中的下列配置

vi conf/application-mysql.yaml

spring:

datasource:

driver-class-name: com.mysql.jdbc.Driver

url: jdbc:mysql://127.0.0.1:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8

username: dolphin

password: dolphin

hikari:

connection-test-query: select 1

minimum-idle: 5

auto-commit: true

validation-timeout: 3000

pool-name: DolphinScheduler

maximum-pool-size: 50

connection-timeout: 30000

idle-timeout: 600000

leak-detection-threshold: 0

initialization-fail-timeout: 1

還需要手動添加 [ mysql-connector-java 驅動 jar ] 包到 lib 目錄下,這裏下載的是mysql-connector-java-8.0.16.jar

· 修改並保存完後,執行 script 目錄下的創建表及導入基礎數據腳本

sh script/create-dolphinscheduler.sh

發現報錯,報出來數據庫不對爲h2,原因是因爲初始化數據腳本是按照

/opt/dolphin/apache-dolphinscheduler-2.0.2-bin/conf/config/install_config.conf

去讀取配置

可以看下create-dolphinscheduler.sh文件

裏面加載了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="ht-28-tdh82,ht-28-tdh83"

# 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="ht-28-tdh84"

# 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="ht-28-tdh82:default,ht-28-tdh83: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="ht-28-tdh84"

# 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="ht-28-tdh84"

# 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="ht-28-tdh84"

# 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/dolphin/apache-dolphinscheduler-2.0.2-bin"

# 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="dolphin"

# 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="/opt/dolphin/apache-dolphinscheduler-2.0.2-bin/tmp"

# ---------------------------------------------------------

# 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="/usr/java/jdk1.8.0_144"

# 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=${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=${SPRING_DATASOURCE_URL:-"jdbc:mysql://localhost:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8"}

# Spring datasource username

SPRING_DATASOURCE_USERNAME=${SPRING_DATASOURCE_USERNAME:-"dolphin"}

# Spring datasource password

SPRING_DATASOURCE_PASSWORD=${SPRING_DATASOURCE_PASSWORD:-"dolphin"}

# ---------------------------------------------------------

# 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="198.28.1.81:2181,198.28.1.82:2181,198.28.1.83:2181"

# The root of zookeeper, for now DolphinScheduler default registry server is zookeeper.

zkRoot="/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="NONE"

# 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://198.28.1.81: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 re

sourcemanager hostname

singleYarnIp="yarnIp1"

# who has permission to create directory under HDFS/S3 root path

# Note: if kerberos is enabled, please config hdfsRootUser=

hdfsRootUser="hdfs"

# 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"

# username keytab path

keytabPath="$installPath/conf/hdfs.keytab"

# kerberos expire time, the unit is hour

kerberosExpireTime="2"

# use sudo or not

sudoEnable="true"

# worker tenant auto create

workerTenantAutoCreate="false"

2.0.2版本的ds存在一個bug就是ips的配置中不能輸入server節點,因爲server節點安裝的時候會scp文件到ips裏面的機器,導致server節點自己scp自己導致文件夾丟失

可以查看根目錄install.sh

存在wps79F1.tmp_thumb[1]我們查看該文件內容如下

wps79F2.tmp_thumb[1]

可以發現scp是通過循環ips裏面的機器scp的,有點問題

環境變量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.

#

export HADOOP_HOME=/opt/soft/hadoop

export HADOOP_CONF_DIR=/opt/soft/hadoop/etc/hadoop

export SPARK_HOME1=/opt/soft/spark1

export SPARK_HOME2=/opt/soft/spark2

export PYTHON_HOME=/opt/soft/python

export JAVA_HOME=/usr/java/jdk1.8.0_144

export HIVE_HOME=/opt/soft/hive

export FLINK_HOME=/opt/soft/flink

export DATAX_HOME=/opt/soft/datax

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:$PATH

執行根目錄install.sh安裝部署

sh install.sh

會出現啓動成功的狀態

訪問頁面

http://198.28.1.84:12345/dolphinscheduler

wps79F3.tmp_thumb[1]

下次說下功能使用吧,謝謝

問題解決:

1.mysql開啓外網訪問,參考https://www.cnblogs.com/ningy1009/p/12806748.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章