Seatunnel 集成 S3 作为 Checkpoint 存储 完整部署步骤(从下载到安装验证)
一、前置环境检查与准备
1. 基础环境验证
执行以下命令确认环境满足要求:
# 1. 检查 Kubernetes 集群(版本 ≥1.20)
kubectl version --short | grep Server Version
# 示例输出:Server Version: v1.24.10
# 2. 检查 Helm(版本 ≥3.0)
helm version --short
# 示例输出:v3.12.0+g1a51648
# 3. 确认 S3 资源就绪
# - 已创建 S3 桶(如 seatunnel-checkpoint)
# - 已获取 S3 AccessKey/SecretKey
# - 测试 S3 端点可访问(以 AWS S3 为例)
curl -I http://192.168.192.119:9000
# 私有 MinIO 示例:curl -I http://minio:9000
2. 下载 Seatunnel Helm 包
# 创建工作目录
mkdir -p /opt/seatunnel-deploy && cd /opt/seatunnel-deploy
# 下载 2.3.10 版本 Helm 包(官方源)
export VERSION=2.3.10
helm pull oci://registry-1.docker.io/apache/seatunnel-helm --version ${VERSION}
# 解压 Helm 包
tar -xvf seatunnel-helm-${VERSION}.tgz
# 进入解压后的目录(核心配置目录)
cd seatunnel-helm
二、修改核心配置文件
步骤1:修改 Checkpoint 存储配置(seatunnel-helm/conf/seatunnel.yaml)
将原有 checkpoint.storage 从 hdfs 改为 s3,替换整个文件内容(保留原有注释):
# 覆盖编辑 seatunnel/conf/seatunnel.yaml
sudo tee /opt/seatunnel-deploy/seatunnel-helm/conf/seatunnel.yaml << 'EOF'
# 补充为S3存储\WEB UI Basic 认证
seatunnel:
engine:
history-job-expire-minutes: 1440
backup-count: 1
queue-type: blockingqueue
print-execution-info-interval: 60
print-job-metrics-info-interval: 60
classloader-cache-mode: true
slot-service:
dynamic-slot: true
http:
enable-http: true
port: 8080
enable-dynamic-port: false
port-range: 100
# WEB UI开启 Basic 认证
enable-basic-auth: true
basic-auth-username: "admin"
basic-auth-password: "123456"
checkpoint:
interval: 300000
timeout: 10000
storage:
type: hdfs # 改为 S3 存储
max-retained: 3
plugin-config:
storage.type: s3
# S3 配置
namespace: "/seatunnel/engine/"
s3.bucket: "s3a://seatunnel-checkpoint"
fs.defaultFS: "s3a://seatunnel-checkpoint"
fs.s3a.endpoint: "http://192.168.192.119:9000"
fs.s3a.path.style.access: true
fs.s3a.access.key: "seatunnel"
fs.s3a.secret.key: "123456"
fs.s3a.aws.credentials.provider: org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider
telemetry:
metric:
enabled: true
EOF
步骤3:修改 Helm 变量配置(seatunnel-helm/custom-values.yaml)
sudo tee /opt/seatunnel-deploy/seatunnel-helm/custom-values.yaml << 'EOF'
image:
registry: "harbor.local/seatunnel/seatunnel"
tag: "2.3.10-new-driver"
# registry: "apache/seatunnel"
# tag: ""
pullPolicy: "IfNotPresent"
pullSecret: ""
master:
## 启动 master 节点的命令
command: []
## 用于替换现有 Pod 为新 Pod 的部署策略
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 50%
## 期望的 master 节点副本数量
replicas: "2"
## 可以使用注解为对象附加任意非标识性元数据
## 工具和库等客户端可以获取这些元数据
annotations:
prometheus.io/path: /hazelcast/rest/instance/metrics
prometheus.io/port: "5801"
prometheus.io/scrape: "true"
prometheus.io/role: "seatunnel-master"
## 亲和性是一组亲和性调度规则,如果指定,则会作为 Pod 的调度约束
## 更多信息: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#affinity-v1-core
affinity: {}
## 节点选择器,必须匹配节点标签才能将 Pod 调度到该节点上
## 只有匹配节点标签的 Pod 才能被调度到对应节点
## 更多信息: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
nodeSelector: {}
## 容忍度会在准入阶段附加到使用该运行时类的 Pod 上(排除重复项),
## 实际上是将 Pod 和运行时类所容忍的节点集合合并
tolerations: []
## 该容器所需的计算资源,无法更新
## 更多信息: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container
resources: {}
# resources:
# limits:
# memory: "4Gi"
# cpu: "4"
# requests:
# memory: "2Gi"
# cpu: "500m"
## 容器存活探针的周期性检测,如果探针失败,容器将被重启,无法更新
## 更多信息: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
livenessProbe:
tcpSocket:
port: hazelcast-port
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
successThreshold: 1
## 容器服务就绪探针的周期性检测,如果探针失败,容器将被从服务端点移除,无法更新
## 更多信息: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
readinessProbe:
enabled: true
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
successThreshold: 1
worker:
## 启动 worker 节点的命令
command: []
## 用于替换现有 Pod 为新 Pod 的部署策略
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 50%
## 期望的 worker 节点副本数量
replicas: "2"
## 可以使用注解为对象附加任意非标识性元数据
## 工具和库等客户端可以获取这些元数据
## 添加 Prometheus 采集注解以收集监控指标
annotations:
prometheus.io/path: /hazelcast/rest/instance/metrics
prometheus.io/port: "5801"
prometheus.io/scrape: "true"
prometheus.io/role: "seatunnel-worker"
## 亲和性是一组亲和性调度规则,如果指定,则会 作为 Pod 的调度约束
## 更多信息: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#affinity-v1-core
affinity: {}
## 节点选择器,必须匹配节点标签才能将 Pod 调度到该节点上
## 只有匹配节点标签的 Pod 才能被调度到对应节点
## 更多信息: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
nodeSelector: {}
## 容忍度会在准入阶段附加到使用该运行时类的 Pod 上(排除重复项),
## 实际上是将 Pod 和运行时类所容忍的节点集合合并
tolerations: []
## 该容器所需的计算资源,无法更新
## 更多信息: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
resources: {}
# resources:
# limits:
# memory: "4Gi"
# cpu: "4"
# requests:
# memory: "2Gi"
# cpu: "500m"
## 容器存活探针的周期性检测,如果探针失败,容器将被重启,无法更新
## 更多信息: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
livenessProbe:
tcpSocket:
port: hazelcast-port
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
successThreshold: 1
## 容器服务就绪探针的周期性检测,如果探针失败,容器将被从服务端点移除,无法更新
## 更多信息: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
readinessProbe:
enabled: true
initialDelaySeconds: "30"
periodSeconds: "30"
timeoutSeconds: "5"
failureThreshold: "3"
successThreshold: "1"
ingress:
enabled: true
className: "nginx"
host: seatunnel.k3s.local
path: /
annotations: {}
tls:
enabled: false
secretName: "seatunnel-tls"
EOF
三、部署 Seatunnel 到 Kubernetes
# 进入 Helm 目录
cd /opt/seatunnel-deploy/seatunnel-helm
# 执行 Helm 部署(首次部署)
helm dependency build && \
helm upgrade --install seatunnel . --create-namespace -n seatunnel -f custom-values.yaml
# 若已部署过,执行升级(配置变更后)
# helm upgrade seatunnel . -n seatunnel
# 查看部署进度
kubectl rollout status deployment/seatunnel-master -n seatunnel
kubectl rollout status deployment/seatunnel-worker -n seatunnel
# 查看 Pod 状态(确保 Master/Worker 均为 Running)
kubectl get pods -n seatunnel
# 示例输出:
# NAME READY STATUS RESTARTS AGE
# seatunnel-master-7f89d76c8-2x78z 1/1 Running 0 2m
# seatunnel-master-7f89d76c8-9k45s 1/1 Running 0 2m
# seatunnel-worker-876d98765-5t678 1/1 Running 0 2m
# seatunnel-worker-876d98765-8b789 1/1 Running 0 2m
五、验证部署与 S3 Checkpoint 配置
步骤1:验证 Seatunnel 服务可用性
# 端口转发访问 Seatunnel REST API
kubectl port-forward -n seatunnel svc/seatunnel-master 8080:8080 &
# 测试 API 可用性
curl http://127.0.0.1:8080/running-jobs
# 示例输出(无运行任务):{"status":"success","data":[]}
# 需要在本机上面添加dns
sudo tee -a /etc/hosts <<EOF
10.2.10.151 seatunnel.k3s.local # 替换为你的nginx IP
EOF
# rest API ,浏览器访问:http://seatunnel.k3s.local/
# 远程跑个简单示例
curl http://seatunnel.k3s.local/submit-job/upload --form 'config_file=@"/opt/seatunnel-deploy/seatunnel-helm/v2.streaming.conf.template"' --form 'jobName=st.example.template'
# 查询正在运行的job
curl http://seatunnel.k3s.local/running-jobs
# 查询job日志
curl http://seatunnel.k3s.local/logs/1062931212563120129?format=json
# 停止Job作业
curl -X POST http://seatunnel.k3s.local/stop-job \
-H "Content-Type: application/json" \
-d '{"jobId": 1064080943393800195,"isStopWithSavePoint": false}'
# 查询系统信息
curl http://seatunnel.k3s.local/system-monitoring-information
# 更多接口可以在官方查询:https://seatunnel.apache.org/zh-CN/docs/seatunnel-engine/rest-api-v2
步骤2:验证 S3 连通性与 Checkpoint 写入
# 1. 获取 Master Pod 名称
MASTER_POD=$(kubectl get po -n seatunnel -l 'app.kubernetes.io/name=seatunnel-master' | sed '1d' | awk '{print $1}' | head -n1)
# 2. 进入 Pod 执行测试任务(触发 Checkpoint 写入 S3)
kubectl exec -it $MASTER_POD -n seatunnel -- /bin/bash
# 3. 在 Pod 内执行测试任务(使用内置模板)
./bin/seatunnel.sh --config ./config/v2.batch.config.template -e local
# 4. 退出 Pod 后,检查 S3 桶内是否生成 Checkpoint 目录
# 登录 S3/MinIO 控制台,查看桶(如 seatunnel-checkpoint)下是否有 /seatunnel/checkpoint_snapshot/ 目录
步骤3:检查日志确认无异常
# 查看 Master Pod 日志,验证 S3 配置生效
kubectl logs -f $MASTER_POD -n seatunnel | grep -E "S3|Checkpoint|s3a"
# 关键成功日志示例:
# "Successfully uploaded checkpoint to s3a://seatunnel-checkpoint/seatunnel/checkpoint_snapshot/..."
# "S3 storage initialized for checkpoint"