您现在的位置是:首页 > 文章详情

手把手教你掌握SeaTunnel k8s运行Zeta引擎本地模式的技巧

日期:2024-04-23点击:148

file

转载自小虾米0.0

导读:随着Kubernetes的普及和发展,越来越多的企业和团队开始使用Kubernetes来管理和部署应用程序。然而,Kubernetes的默认工作方式可能不是最佳的选择,尤其是在需要更高效、更可靠的应用程序部署和管理能力时。因此,SeaTunnel提供了一种运行Zeta引擎(local-mode模式)的方法,可以让Kubernetes在本地运行Zeta引擎,实现更高效的应用程序部署和管理。在本文中,我们将探索SeaTunnel k8s运行zeta引擎(local-mode模式)的更多信息,了解如何更好地利用Zeta引擎的优势。

运行

  1. 将SeaTunnel上传至服务器上。我之前已经解压并执行过install-plugin.sh,这里为了方便,我直接用的执行过install-plugin.sh脚本之后的seatunnel做演示。

执行过install-plugin后的lib目录包含如下

file

tar -zxvf apache-seatunnel-2.3.3-bin.tar.gz sh apache-seatunnel-2.3.3/bin/install-plugin.sh tar -czvf apache-seatunnel-2.3.3-bin.tar.gz apache-seatunnel-2.3.3 
  1. 构建SeaTunnel镜像。在安装seatunnel的同级文件夹下创建Dockerfile。配置如下,可自行选择版本
FROM openjdk:8 ENV SEATUNNEL_VERSION="2.3.3" COPY /apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz /opt/apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz WORKDIR /opt RUN tar -xzvf apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz RUN mv apache-seatunnel-${SEATUNNEL_VERSION} seatunnel RUN rm -f /opt/apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz WORKDIR /opt/seatunnel 

执行命令

docker build -t seatunnel:2.3.3 -f Dockerfile. 
  1. 查看镜像
docker images 

如下所示镜像

file

  1. 将镜像load进k8s,这里用的minikube做演示
minikube image load seatunnel:2.3.3 
minikube image ls 

查看镜像

file

  1. 创建seatunnel.streaming.conf 如下所示
env { execution.parallelism = 1 job.mode = "STREAMING" checkpoint.interval = 2000 } source { FakeSource { result_table_name = "fake" row.num = 160000 schema = { fields { name = "string" age = "int" } } } } transform { } sink { Console {} } 
  1. 创建configmap
kubectl create cm seatunnel-config \ --from-file=seatunnel.streaming.conf=seatunnel.streaming.conf 
  1. 创建seatunnel.yaml如下示例
apiVersion: v1 kind: Pod metadata: name: seatunneltest spec: containers: - name: seatunnel image: seatunnel:2.3.3 command: ["/bin/sh","-c","/opt/seatunnel/bin/seatunnel.sh --config /data/seatunnel.streaming.conf -e local"] volumeMounts: - name: seatunnel-config mountPath: /data/seatunnel.streaming.conf subPath: seatunnel.streaming.conf volumes: - name: seatunnel-config configMap: name: seatunnel-config items: - key: seatunnel.streaming.conf path: seatunnel.streaming.conf ~ 

执行

kubectl apply -f seatunnel.yaml 

查看pod结果如下 file file

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/weixin_41854429/article/details/132619265

本文由 白鲸开源科技 提供发布支持!

原文链接:https://my.oschina.net/SeaTunnel/blog/11054386
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章