赞
踩
SeaTunnel提供了一种运行Zeta引擎(cluster-mode)的方法,可以让Kubernetes在本地运行Zeta引擎,实现更高效的应用程序部署和管理。在本文中,我们将探索SeaTunnel k8s运行zeta引擎(cluster-mode模式)的更多信息,了解如何更好地利用Zeta引擎的优势。
执行过install-plugin后的lib目录包含如下:
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
FROM openjdk:8
ENV SEATUNNEL_HOME="/opt/seatunnel"
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.
docker images
如下所示镜像
将镜像load进k8s,这里用的minikube做演示
minikube image load seatunnel:2.3.3
创建configmap如下
kubectl create configmap hazelcast-client --from-file= config/hazelcast-client.yaml
kubectl create configmap hazelcast --from-file=config/hazelcast.yaml
kubectl create configmap seatunnelmap --from-file=config/seatunnel.yaml
使用Reloader实现更新configmap后自动重启pod
wget https://raw.githubusercontent.com/stakater/Reloader/master/deployments/kubernetes/reloader.yaml
kubectl apply -f reloader.yaml
apiVersion: v1 kind: Service metadata: name: seatunnel spec: selector: app: seatunnel ports: - port: 5801 name: seatunnel clusterIP: None --- apiVersion: apps/v1 kind: StatefulSet metadata: name: seatunnel annotations: configmap.reloader.stakater.com/reload: "hazelcast,hazelcast-client,seatunnelmap" spec: serviceName: "seatunnel" replicas: 3 selector: matchLabels: app: seatunnel template: metadata: labels: app: seatunnel spec: containers: - name: seatunnel image: seatunnel:2.3.3 imagePullPolicy: IfNotPresent ports: - containerPort: 5801 name: client command: ["/bin/sh","-c","/opt/seatunnel/bin/seatunnel-cluster.sh -DJvmOption=-Xms2G -Xmx2G"] resources: limits: cpu: "1" memory: 4G requests: cpu: "1" memory: 2G volumeMounts: - mountPath: "/opt/seatunnel/config/hazelcast.yaml" name: hazelcast subPath: hazelcast.yaml - mountPath: "/opt/seatunnel/config/hazelcast-client.yaml" name: hazelcast-client subPath: hazelcast-client.yaml - mountPath: "/opt/seatunnel/config/seatunnel.yaml" name: seatunnelmap subPath: seatunnel.yaml volumes: - name: hazelcast configMap: name: hazelcast - name: hazelcast-client configMap: name: hazelcast-client - name: seatunnelmap configMap: name: seatunnelmap
kubectl apply -f seatunnel-cluster.yml
kubectl edit cm hazelcast
修改集群地址
这里采用的是headless service访问模式
一般pod之间访问其格式为 <pod-name>.<service-name>.<namespace>.svc.cluster.local
如下示例
友情提示:不要用tab,用空格 。不然会报错
kubectl edit cm hazelcast-client
kubectl edit cm seatunnelmap
此处改为自己的hdfs地址。
kubectl exec -it seatunnel-0 /bin/bash
cat config/hazelcast.yaml
tail -200f logs/seatunnel-engine-server.log
我们发现集群已经正常运行.
我们可以再新打开一个连接,登录另一个pod节点执行任务来测试集群:
kubectl exec -it seatunnel-1 /bin/bash
bin/seatunnel.sh --config config/v2.streaming.conf.template
我们发现其他pod内也已经开始运行任务
原文链接:https://blog.csdn.net/weixin_41854429/article/details/132836402
本文由 白鲸开源科技 提供发布支持!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。