您现在的位置是:首页 > 技术教程 正文

SeaTunnel Web安装 一把成

admin 阅读: 2024-04-01
后台-插件-广告管理-内容页头部广告(手机)

安装相关jar包,以及SeaTunnel 和Web 打成的包,可以直接使用,但是需要安装MySQL客户端的分享:

链接:https://pan.baidu.com/s/1qrt1RAX38SgIpNklbQJ7pA 
提取码:0kmf 

1. 环境准备

环境名称版本
系统环境CentOS7.9
Java环境JDK1.8

1.1 系统环境

1.2 Java环境安装

下载jdk1.8安装包并拷贝到服务器

  1. # 进入文件夹
  2. cd /usr/local
  3. # 将jdk拷贝到该位置
  4. # 解压文件
  5. tar -zxvf jdk-8u381-linux-x64.tar.gz

修改环境变量

vim /etc/profile

在环境变量中添加Java环境

  1. export JAVA_HOME=/usr/local/jdk1.8.0_381/
  2. export CLASSPATH=$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
  3. export PATH=$PATH:$JAVA_HOME/bin

重新加载环境变量

source /etc/profile

验证Java环境

java -version

1.3 SeaTunnel单节点安装

下载安装包

下载地址:

Apache SeaTunnel

下载SeaTunnel安装包

下载SeaTunnel Web安装包

创建安装SeaTunnel 目录

  1. # 创建用于安装SeaTunnel 后台引擎的目录
  2. mkdir -p /opt/seatunnel/backend
  3. # 创建用户安装SeaTunnel Web前台页面的目录
  4. mkdir -p /opt/seatunnel/web

拷贝并安装SeaTunnel

  1. # 进入到SeaTunnel 后台安装目录,将下载好的安装包拷贝到该目录
  2. [root@localhost backend]# pwd
  3. /opt/seatunnel/backend
  4. [root@localhost backend]# ls
  5. apache-seatunnel-2.3.3-bin.tar.gz
  6. # 安装SeaTunnel 后台
  7. tar -zxvf apache-seatunnel-2.3.3-bin.tar.gz
  8. # 进入到SeaTunnel Web页面程序安装目录,将下载号的安装包拷贝到该目录
  9. [root@localhost web]# pwd
  10. /opt/seatunnel/web
  11. [root@localhost web]# ls
  12. apache-seatunnel-web-1.0.0-bin.tar.gz
  13. # 安装SeaTunnel Web页面程序
  14. tar -zxvf apache-seatunnel-web-1.0.0-bin.tar.gz

将SeaTunnel 后台配置到环境变量中

  1. # 打开环境变量文件
  2. vim /etc/profile
  3. # 在环境变量文件最后添加如下配置
  4. export SEATUNNEL_HOME=/opt/seatunnel/backend/apache-seatunnel-2.3.3
  5. export PATH=$PATH:$SEATUNNEL_HOME/bin
  6. # 重新加载环境变量文件
  7. source /etc/profile

安装需要的连接器

  1. # 进入到seatunnel 安装目录下
  2. [root@localhost seatunnel]# cd apache-seatunnel-2.3.3
  3. # 进入到插件配置文件中
  4. [root@localhost apache-seatunnel-2.3.3]# vim config/plugin_config
  5. # 删除多余连接器,留下需要用到的连接器
  6. --connectors-v2--
  7. connector-cdc-mysql
  8. connector-cdc-sqlserver
  9. connector-doris
  10. connector-elasticsearch
  11. connector-jdbc
  12. --end--
  13. # 退出保存连接器配置文件
  14. :qw
  15. # 在线安装拦截器
  16. [root@localhost apache-seatunnel-2.3.3]# sh bin/install-plugin.sh
  17. # 等待安装,安装完成后可查看已经安装的连接器
  18. [root@localhost apache-seatunnel-2.3.3]# ls connectors/seatunnel/*
  19. connectors/seatunnel/connector-cdc-mysql-2.3.3.jar
  20. connectors/seatunnel/connector-cdc-sqlserver-2.3.3.jar
  21. connectors/seatunnel/connector-console-2.3.3.jar
  22. connectors/seatunnel/connector-doris-2.3.3.jar
  23. connectors/seatunnel/connector-elasticsearch-2.3.3.jar
  24. connectors/seatunnel/connector-fake-2.3.3.jar
  25. connectors/seatunnel/connector-jdbc-2.3.3.jar

注意:

connector-jdbc 连接器可以连接多种使用JDBC进行连接的多种数据库,如下:

MySQL、PostgreSQL、DM、Phoenix 、SQLServer、Oracle、sqlite、GBase8a、StarRocks、db2、saphana、Doris、teradata、Redshift、Snowflake、Vertica、OceanBase

拷贝需要的数据库连接jar包

  1. # 进入SeaTunnel 后台安装目录
  2. cd /opt/seatunnel/backend/apache-seatunnel-2.3.3
  3. # 创建连接器对应的目录,用于存放数据库连接驱动
  4. [root@localhost apache-seatunnel-2.3.3]# mkdir -p plugins/jdbc/lib/
  5. # 将下载的数据库连接包上传到该目录下
  6. [root@localhost lib]# pwd
  7. /opt/seatunnel/backend/apache-seatunnel-2.3.3/plugins/jdbc/lib
  8. [root@localhost lib]# ls
  9. mysql-connector-java-8.0.28.jar ojdbc8.jar postgresql-42.6.0.jar

数据库连接包下载地址:

数据库

下载地址

mysql

https://mvnrepository.com/artifact/mysql/mysql-connector-java

oracle

https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc8

postgresql

https://mvnrepository.com/artifact/org.postgresql/postgresql

doris

https://mvnrepository.com/artifact/mysql/mysql-connector-java

测试验证

  1. # 进入SeaTunnel 后台安装目录
  2. cd /opt/seatunnel/backend/apache-seatunnel-2.3.3
  3. # 跑样例脚本
  4. sh bin/seatunnel.sh --config config/v2.batch.config.template -e local

出现以下信息表示验证成功

后台启用服务

  1. # 进入SeaTunnel 后台安装目录
  2. cd /opt/seatunnel/backend/apache-seatunnel-2.3.3
  3. # 启动服务
  4. nohup sh bin/seatunnel-cluster.sh 2>&1 &

查看SeaTunnel 运行日志

  1. # 查看SeaTunnel运行日志
  2. tail -100f logs/seatunnel-engine-server.log

日志中有以下信息表示后台启动成功

1.4 安装SeaTunnel Web

注意:必须保证SeaTunnel的后台引擎服务正常运行,Web端才可以正常运行。

安装MySQL客户端

因为SeaTunnel Web 需要连接到MySQL数据库,并初始化数据库,所以需要安装MySQL Client。

  1. # 先检查服务器中是否存在mariadb
  2. rpm -qa|grep mariadb
  3. #删除相关依赖包(若不存在,可以跳过)
  4. rpm -e --nodeps mariadb-libs
  5. #检查是否删除干净
  6. rpm -qa|grep mariadb
  7. # 检查MySQL
  8. rpm -qa|grep mysql
  9. # 创建一个目录用于存放MySQL Client 安装文件
  10. mkdir -p /opt/mysqlrpm
  11. # 将安装包拷贝到该目录下
  12. [root@localhost mysqlrpm]# pwd
  13. /opt/mysqlrpm
  14. [root@localhost mysqlrpm]# ls
  15. lrzsz-0.12.20-36.el7.x86_64.rpm
  16. mysql-community-client-5.7.40-1.el7.x86_64.rpm
  17. mysql-community-common-5.7.40-1.el7.x86_64.rpm
  18. mysql-community-libs-5.7.40-1.el7.x86_64.rpm
  19. # 安装lrzsz
  20. rpm -ivh lrzsz-0.12.20-36.el7.x86_64.rpm
  21. # 按照顺序安装MySQL Client
  22. rpm -ivh mysql-community-common-5.7.40-1.el7.x86_64.rpm
  23. rpm -ivh mysql-community-libs-5.7.40-1.el7.x86_64.rpm
  24. rpm -ivh mysql-community-client-5.7.40-1.el7.x86_64.rpm

修改SeaTunnel Web 下script/seatunnel_server_env.sh中连接数据库信息

  1. # 进入到SeaTunnel Web 安装目录
  2. cd /opt/seatunnel/web/apache-seatunnel-web-1.0.0-bin
  3. # 备份script/seatunnel_server_env.sh文件
  4. cp script/seatunnel_server_env.sh script/seatunnel_server_env.sh.bak
  5. # 修改script/seatunnel_server_env.sh文件
  6. vim script/seatunnel_server_env.sh
  7. # 修改以下配置信息
  8. export HOSTNAME="127.0.0.1"
  9. export PORT="3306"
  10. export USERNAME="root"
  11. export PASSWORD="123456"
  12. # 修改如下,加上了前缀,以防与系统中其它配置冲突
  13. # 将数据库连接信息修改成你要链接的信息
  14. export STWEB_HOSTNAME="127.0.0.1"
  15. export STWEB_PORT="3306"
  16. export STWEB_USERNAME="root"
  17. export STWEB_PASSWORD="123456"

修改SeaTunnel Web 下script/init_sql.sh 中连接数据库信息

vim script/init_sql.sh

主要是保证里边的${XXXXX}的配置信息与script/seatunnel_server_env.sh中的保持一致。

执行数据库初始化脚本

  1. # 进入SeaTunnel Web 安装目录
  2. cd /opt/seatunnel/web/apache-seatunnel-web-1.0.0-bin
  3. # 执行初始化文件
  4. sh script/init_sql.sh

修改SeaTunnel Web 连接MySQL数据库的配置信息

  1. # 进入SeaTunnel Web 安装目录
  2. cd /opt/seatunnel/web/apache-seatunnel-web-1.0.0-bin
  3. # 打开SeaTunnel Web 配置文件
  4. vim conf/application.yml
  5. # 修改以下部分配置:端口号,MySQL连接IP,MySQL用户名和密码
  6. server:
  7. #port: 8801
  8. port: 8882
  9. spring:
  10. application:
  11. name: seatunnel
  12. jackson:
  13. date-format: yyyy-MM-dd HH:mm:ss
  14. datasource:
  15. driver-class-name: com.mysql.jdbc.Driver
  16. url: jdbc:mysql://192.168.1.111:3306/seatunnel?useSSL=false&useUnicode=true&characterEnc
  17. oding=utf-8&allowMultiQueries=true&allowPublicKeyRetrieval=true
  18. username: root
  19. password: 123456

配置client信息

  1. # 将seatunnel后台的两个文件拷贝到web的conf目录下
  2. cp /opt/seatunnel/backend/apache-seatunnel-2.3.3/config/hazelcast-client.yaml conf/
  3. cp /opt/seatunnel/backend/apache-seatunnel-2.3.3/connectors/plugin-mapping.properties conf/

下载Web程序需要的数据源(数据源需要的各种jar包)

这里在各种jar包,如果缺失的话,在Web页面创建数据源时会出现空数据源的情况。

下载jar包

首先你自己的电脑上安装了github

下载jar包额度脚本

我是在我电脑的D盘根目录下,创建了download_datasource.sh文件,文件内容如下:

有两处需要修改,请看注释。

  1. #!/bin/bash
  2. #
  3. # Licensed to the Apache Software Foundation (ASF) under one or more
  4. # contributor license agreements. See the NOTICE file distributed with
  5. # this work for additional information regarding copyright ownership.
  6. # The ASF licenses this file to You under the Apache License, Version 2.0
  7. # (the "License"); you may not use this file except in compliance with
  8. # the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. #This script is used to download the connector plug-ins required during the running process.
  19. #All are downloaded by default. You can also choose what you need.
  20. #You only need to configure the plug-in name in config/plugin_config.
  21. # get seatunnel web home
  22. # SEATUNNEL_WEB_HOME=$(cd $(dirname $0);cd ../;pwd)
  23. # 此处需要修改成你本地的目录
  24. DATASOURCE_DIR=D:/down_jars
  25. # If you don’t want to download a certain data source, you can delete the element below
  26. datasource_list=(
  27. "datasource-plugins-api"
  28. "datasource-elasticsearch"
  29. "datasource-hive"
  30. "datasource-jdbc-clickhouse"
  31. "datasource-jdbc-hive"
  32. "datasource-jdbc-mysql"
  33. "datasource-jdbc-oracle"
  34. "datasource-jdbc-postgresql"
  35. "datasource-jdbc-redshift"
  36. "datasource-jdbc-sqlserver"
  37. "datasource-jdbc-starrocks"
  38. "datasource-jdbc-tidb"
  39. "datasource-kafka"
  40. "datasource-mysql-cdc"
  41. "datasource-s3"
  42. "datasource-sqlserver-cdc"
  43. "datasource-starrocks"
  44. )
  45. # the datasource default version is 1.0.0, you can also choose a custom version. eg: 1.1.2: sh install-datasource.sh 2.1.2
  46. version=1.0.0
  47. if [ -n "$1" ]; then
  48. version="$1"
  49. fi
  50. echo "Downloading SeaTunnel Web Datasource lib, usage version is ${version}"
  51. # create the datasource directory
  52. if [ ! -d "$DATASOURCE_DIR" ];
  53. then
  54. mkdir -p "$DATASOURCE_DIR"
  55. echo "Created datasource directory."
  56. fi
  57. for i in "${datasource_list[@]}"
  58. do
  59. echo "$i"
  60. echo "Downloading datasource: " "$i"
  61. # 修改成mvn
  62. mvn dependency:get -DgroupId=org.apache.seatunnel -DartifactId="$i" -Dversion="$version" -Ddest="$DATASOURCE_DIR"
  63. done

之后在download_datasource.sh目录下点击鼠标右键,选择Git Bash Here

之后在打开的页面执行 sh download_datasource.sh  点击回车,等待下载完成。

之后将下载下来的包,拷贝到SeaTunnel Web 程序的 /libs目录下。

将MySQL Jar 包拷贝到libs目录下

将mysql连接数据库的Jar 拷贝到 /libs 目录下,否则Web程序启动时会报错,连不上数据库。

启动SeaTunnel Web 程序

  1. # 进入SeaTunnel Web 安装目录
  2. cd /opt/seatunnel/web/apache-seatunnel-web-1.0.0-bin
  3. # 启动SeaTunnel Web
  4. sh bin/seatunnel-backend-daemon.sh start
  5. # 查看启动日志
  6. tail -100f logs/seatunnel-web.log

配置开放端口号(两种方式)

  1. #-------------iptables-----------------
  2. #开打端口号开放配置文件
  3. vim /etc/sysconfig/iptables
  4. # 添加一行
  5. -A INPUT -p tcp -m state --state NEW -m tcp --dport 8882 -j ACCEPT
  6. # 重启启动防火墙
  7. systemctl restart iptables.service
  8. #------------firewall-------------------
  9. # 依次执行下面命令
  10. firewall-cmd --zone=public --add-port=8882/tcp --permanent
  11. firewall-cmd --reload
  12. firewall-cmd --list-all

查看日志文件

访问SeaTunnel Web

http://192.168.182.166:8882

默认用户名密码:admin/admin

到此为止SeaTunnel 与SeaTunnel Web 已经安装完成。

标签:
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

在线投稿:投稿 站长QQ:1888636

后台-插件-广告管理-内容页尾部广告(手机)
关注我们

扫一扫关注我们,了解最新精彩内容

搜索