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

SeaTunnel-web in K8S

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

下载,官网下载有问题,上dlcdn.apache.org下载
https://dlcdn.apache.org/seatunnel/seatunnel-web/1.0.0/apache-seatunnel-web-1.0.0-bin.tar.gz

apache-seatunnel-2.3.3中执行bin/install-plugin.sh下载connectors

下载web的源码

https://github.com/apache/seatunnel-web.git

seatunnel-server/seatunnel-app/src/main/bin/download_datasource.sh

将download_datasource.sh复制到/root/seatunnel/apache-seatunnel-web-1.0.0-bin/bin目录
sh download_datasource.sh 下载 datasource

vim conf/application.yml修改端口号和数据源信息

根据script目录下的数据表初始化脚本,把数据库建好 seatunnel_server_mysql.sql

将apache-seatunnel-2.3.4/conf目录下的hazelcast-client.yamlplugin-mapping.properties复制过来

hazelcast-client.yaml中的信息连接到之前部署好的SeaTunnel集群

参考:SeaTunnel 2.3.4 Cluster in K8S-CSDN博客

logback-spring.xml文件中的日志级别如果需要可改成debug方便调试


准备创建镜像文件

apache-seatunnel-2.3.3(重命名为:seatunnel-zeta)和apache-seatunnel-web-1.0.0-bin(重命名为:seatunnel,web依赖zeta连接集群)都放在一个容器中。

在镜像中配置相关的环境变量

SEATUNNEL_HOME=/opt/seatunnel-zeta
SEATUNNEL_WEB_HOME=/opt/seatunnel
ST_WEB_BASEDIR_PATH=/opt/seatunnel/ui


将connectors和plugins目录复制到web下,打包后拷贝到镜像中,然后镜像中编写的启动脚本会把该目录移动到seatunnel-zeta目录下,不然在web界面选择不了数据源,connectors又依赖plugins  
 cp -r /root/seatunnel/apache-seatunnel-2.3.3/connectors   /root/seatunnel/apache-seatunnel-web-1.0.0-bin/
 cp -r /root/seatunnel/apache-seatunnel-2.3.3/plugins   /root/seatunnel/apache-seatunnel-web-1.0.0-bin/

创建启动脚本 web自带的是后台启动,所以需要自己写个脚本在容器中前台运行
vi apache-seatunnel-web-1.0.0-bin/start.sh

一定要在bin目录下执行启动后的脚本  sh bin/seatunnel-backend-daemon.sh start ,不然找不到首页  jetty err_empty_response 404

参考:CentOs7.x安装部署SeaTunnelWeb遇到的坑_seatunnel unable to connect to any cluster-CSDN博客

  1. #!/bin/bash
  2. cp /opt/seatunnel-zeta/lib/* /opt/seatunnel/libs/
  3. cp /opt/seatunnel/libs/datasource*.jar /opt/seatunnel-zeta/lib/
  4. mv -r /opt/seatunnel/connectors /opt/seatunnel-zeta/
  5. cd /opt/seatunnel/
  6. # 一定要在这个目录执行,不然找不到首页  jetty err_empty_response 404
  7. # https://blog.csdn.net/qq_34905631/article/details/135074860
  8. sh bin/seatunnel-backend-daemon.sh start
  9. tail -f /opt/seatunnel/logs/seatunnel-web.log

创建dockerfile

  1. FROM flink:1.18
  2. ENV SEATUNNEL_VERSION="2.3.3"
  3. ENV SEATUNNEL_WEB_VERSION="1.0.0"
  4. COPY ./apache-seatunnel-web-${SEATUNNEL_WEB_VERSION}-bin.tar /opt/apache-seatunnel-web-${SEATUNNEL_WEB_VERSION}-bin.tar
  5. WORKDIR /opt
  6. RUN tar -xvf apache-seatunnel-web-${SEATUNNEL_WEB_VERSION}-bin.tar
  7. RUN mv apache-seatunnel-web-${SEATUNNEL_WEB_VERSION}-bin seatunnel
  8. RUN rm -f /opt/apache-seatunnel-web-${SEATUNNEL_WEB_VERSION}-bin.tar
  9. WORKDIR /opt/seatunnel
  10. COPY /apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz /opt/apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz
  11. WORKDIR /opt
  12. RUN tar -xzvf apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz
  13. RUN mv apache-seatunnel-${SEATUNNEL_VERSION} seatunnel-zeta
  14. RUN rm -f /opt/apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz
  15. RUN export SEATUNNEL_HOME=/opt/seatunnel-zeta
  16. RUN export SEATUNNEL_WEB_HOME=/opt/seatunnel
  17. RUN export ST_WEB_BASEDIR_PATH=/opt/seatunnel/ui
  18. RUN export PATH=$PATH:$SEATUNNEL_HOME/bin:$SEATUNNEL_WEB_HOME/bin:$ST_WEB_BASEDIR_PATH/bin
  19. ENTRYPOINT ["sh", "/opt/seatunnel/start.sh"]


 tar -cvf apache-seatunnel-web-1.0.0-bin.tar apache-seatunnel-web-1.0.0-bin
 docker build -t yourharbor/yourlib/seatunnel-web:1.0.0 -f dockerfile-seatunnel-web-1.0.0-bin .
 docker push  yourharbor/yourlib/seatunnel-web:1.0.0


vi web.yaml

  1. ---
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5.   name: seatunnel-web-deployment
  6.   labels:
  7.     app: seatunnel-web-dev
  8.   namespace: seatunnel
  9. spec:
  10.   replicas: 1
  11.   selector:
  12.     matchLabels:
  13.       app: seatunnel-web-pod
  14.   template:
  15.     metadata:
  16.       labels:
  17.         app: seatunnel-web-pod
  18.     spec:
  19.       containers:
  20.       - name: seatunnel-web-serivce
  21.         image: yourharbor/yourlib/seatunnel-web:1.0.0
  22.         imagePullPolicy: Always
  23.       tolerations:
  24.       - effect: NoSchedule
  25.         key: node-role.kubernetes.io/control-plane
  26. ---
  27. apiVersion: v1
  28. kind: Service
  29. metadata:
  30.   name: seatunnel-web-svc
  31.   labels:
  32.     app: seatunnel-web-svc
  33.   namespace: seatunnel
  34. spec:
  35.   selector:
  36.     app: seatunnel-web-pod
  37.   ports:
  38.   - name: seatunnel-web-ports
  39.     protocol: TCP
  40.     port: 8801
  41.     nodePort: 3xxxx
  42.     targetPort: 8801
  43.   type: NodePort


部署镜像
kubectl apply -f web.yaml
错了就删除
kubectl delete -f web.yaml
查看pod
kubectl get po -n seatunnel -owide
查看svc
kubectl get svc -n seatunnel -owide
describe
kubectl describe po -n seatunnel seatunnel-web-deployment-75f465bd8b-tcvmf     
logs
kubectl logs -f -n seatunnel seatunnel-web-deployment-75f465bd8b-tcvmf      
进去容器看看
kubectl exec -it -n seatunnel seatunnel-web-deployment-75f465bd8b-tcvmf      -- /bin/bash
容器里访问一下
curl localhost:8801 

admin/admin登录,创建数据源,开始建source和sink


MySQL-CDC数据源建好了连接MySQL8.0输入连接信息时没有Driver信息,所以实现MySQL8.0 CDC会出现找不到合适的Driver的异常

标签:
声明

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

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

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

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

搜索