点亮 ⭐️ Star · 照亮开源之路
GitHub:https://github.com/apache/incubator-seatunnel

前期准备 安装 SeaTunnel Docker 镜像 部署 Flink 算子 运行 SeaTunnel 应用程序
前期准备
Docker Kubernetes helm
minikube 启动 --kubernetes-version=v1.23.3
安装
SeaTunnel Docker 镜像
DS
FROM flink:1.13ENV SEATUNNEL_VERSION="2.1.0"RUN wget https://archive.apache.org/dist/incubator/seatunnel/${SEATUNNEL_VERSION}/apache-seatunnel-incubating-${SEATUNNEL_VERSION}-bin.tar.gzRUN tar -xzvf apache-seatunnel-incubating-${SEATUNNEL_VERSION}-bin.tar.gzRUN mkdir -p $FLINK_HOME/usrlibRUN cp apache-seatunnel-incubating-${SEATUNNEL_VERSION}/lib/seatunnel-core-flink.jar $FLINK_HOME/usrlib/seatunnel-core-flink.jarRUN rm -fr apache-seatunnel-incubating-${SEATUNNEL_VERSION}*
docker build -t seatunnel:2.1.0-flink-1.13 -f Dockerfile 。
minikube image load seatunnel:2.1.0-flink-1.13
部署 Flink 算子
DS
kubectl create -f https://github.com/jetstack/cert-manager/releases/download/v1.7.1/cert-manager.yaml
helm repo add flink-operator-repo https://downloads.apache.org/flink/flink-kubernetes-operator-0.1.0/helm install flink-kubernetes-operator flink-operator-repo/flink-kubernetes-operator
kubectl get podsNAME READY STATUS RESTARTS AGEflink-kubernetes-operator-5f466b8549-mgchb 1/1 Running 3 (23h ago) 16d
运行 SeaTunnel 应用程序
env {execution.parallelism = 1}source {FakeSourceStream {result_table_name = "fake"field_name = "name,age"}}transform {sql {sql = "select name,age from fake"}}sink {ConsoleSink {}}
在您的节点上创建 mnt/data。打开集群中单个节点的 shell。如何打开 shell 取决于您设置集群的方式。例如,本例中我们使用 Minikube,您可以通过输入 minikube ssh 在节点打开一个 shell。在该节点上的 shell 中,创建一个 mnt/data 目录:
minikube ssh# This assumes that your Node uses "sudo" to run commands as the superusersudo mkdir mnt/data
minikube cp flink.streaming.conf mnt/data/flink.streaming.conf
创建 seatunnel-flink.yaml FlinkDeployment 清单:
apiVersion: flink.apache.org/v1alpha1kind: FlinkDeploymentmetadata:namespace: defaultname: seatunnel-flink-streaming-examplespec:image: seatunnel:2.1.0-flink-1.13flinkVersion: v1_14flinkConfiguration:taskmanager.numberOfTaskSlots: "2"serviceAccount: flinkjobManager:replicas: 1resource:memory: "2048m"cpu: 1taskManager:resource:memory: "2048m"cpu: 2podTemplate:spec:containers:- name: flink-main-containervolumeMounts:- mountPath: dataname: config-volumevolumes:- name: config-volumehostPath:path: "/mnt/data"type: Directoryjob:jarURI: local:///opt/flink/usrlib/seatunnel-core-flink.jarentryClass: org.apache.seatunnel.SeatunnelFlinkargs: ["--config", "/data/flink.streaming.conf"]parallelism: 2upgradeMode: stateless
运行示例应用程序:
查看输出
DS
kubectl port-forward svc/seatunnel-flink-streaming-example-rest 8081
kubectl logs \-l 'app in (seatunnel-flink-streaming-example), component in (taskmanager)' \--tail=-1 \-f
+I[Kid Xiong, 1650316786086]+I[Ricky Huo, 1650316787089]+I[Ricky Huo, 1650316788089]+I[Ricky Huo, 1650316789090]+I[Kid Xiong, 1650316790090]+I[Kid Xiong, 1650316791091]+I[Kid Xiong, 1650316792092]
kubectl delete -f seatunnel-flink.yaml
值得一提的是, Apache Doris 从 Apache 软件基金会(ASF)毕业后,这次联合技术活动是 Doris 的毕业首秀,值得期待!
点击链接/扫码预约/点击阅读原文报名(免费):
https://www.slidestalk.com/m/996/stgongzhonghao

扫码预约直播

扫码进入群聊
Apache SeaTunnel

// 保持联络 //
微信号 : Seatunnel
来,和社区一同成长!
往期推荐



点击阅读原文,免费报名

文章转载自SeaTunnel,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




