需要持久化、可重试的长时间工作流,例如订单履约、支付对账、数据管道和人工审批。Temporal 把工作流状态存到数据库,Worker 故障后可以继续执行。
kubectl create namespace temporal
kubectl -n temporal create secret generic temporal-db \
--from-literal=password='***'
helm repo add temporal https://go.temporal.io/helm-charts
helm install temporal temporal/temporal \
--namespace temporal \
--set server.replicaCount=2 \
--set postgresql.enabled=false \
--set server.config.persistence.default.sql.host=postgres \
--set server.config.persistence.default.sql.database=temporal \
--set server.config.persistence.default.sql.user=temporal \
--set server.config.persistence.default.sql.password='***'
kubectl -n temporal get pods
temporal operator namespace create --namespace orders \
--retention 7d
temporal operator namespace list
temporal worker start --namespace orders --task-queue orders
kubectl -n temporal port-forward svc/temporal-web 8080:8080
temporal operator cluster upsert --history-archival-enabled true
temporal workflow start 能创建并执行工作流。namespace 和 Worker 的 Task Queue 不匹配,任务一直 Pending。temporal — namespace、workflow、task queue 管理kubectl — 查看 Temporal 组件psql — 检查数据库连接和表helm — 安装和升级