【发布时间】:2021-08-10 14:16:26
【问题描述】:
当我尝试在 Flink 运行器上运行 TFX 管道/Apache Beam 作业时,它在使用 1 个任务管理器(在一个节点上)和并行度 2(每个任务管理器 2 个任务槽)时工作正常。但是当我在多个任务管理器上以更高的并行度尝试它时挂起,并且消息在两个任务管理器上不断重复:
INFO org.apache.beam.runners.fnexecution.environment.ExternalEnvironmentFactory [] - Still waiting for startup of environment from a65a0c5f8f962428897aac40763e57b0-1334930809.eu-central-1.elb.amazonaws.com:50000 for worker id 1-1
Flink 集群在 AWS EKS Kubernetes 集群上的原生 Kubernetes 部署上运行。
我使用以下参数:
"--runner=FlinkRunner",
"--parallelism=4",
f"--flink_master={flink_url}:8081",
"--environment_type=EXTERNAL",
f"--environment_config={beam_sdk_url}:50000",
"--flink_submit_uber_jar",
"--worker_harness_container_image=none",
编辑:添加有关配置的附加信息
通过设置 Flink 参数,我已将 Beam 工作程序配置为作为边车运行(至少这是我对它应该如何工作的理解):
kubernetes.pod-template-file.taskmanager
它指向一个带有内容的模板文件:
kind: Pod
metadata:
name: taskmanager-pod-template
spec:
#hostNetwork: true
containers:
- name: flink-main-container
#image: apache/flink:scala_2.12
env:
- name: AWS_REGION
value: "eu-central-1"
- name: S3_VERIFY_SSL
value: "0"
- name: PYTHONPATH
value: "/data/flink/src"
args: ["taskmanager"]
ports:
- containerPort: 6122 #22
name: rpc
- containerPort: 6125
name: query-state
livenessProbe:
tcpSocket:
port: 6122 #22
initialDelaySeconds: 30
periodSeconds: 60
- name: beam-worker-pool
env:
- name: PYTHONPATH
value: "/data/flink/src"
- name: AWS_REGION
value: "eu-central-1"
- name: S3_VERIFY_SSL
value: "0"
image: 848221505146.dkr.ecr.eu-central-1.amazonaws.com/flink-workers
imagePullPolicy: Always
args: ["--worker_pool"]
ports:
- containerPort: 50000
name: pool
livenessProbe:
tcpSocket:
port: 50000
initialDelaySeconds: 30
periodSeconds: 60
我还为任务管理器创建了一个 kubernetes 负载均衡器,因此客户端可以连接到端口 50000。所以我在配置时使用该地址:
f"--environment_config={beam_sdk_url}:50000",
编辑 2:看起来一个任务管理器上的 Beam SDK 工具想要连接到另一个任务管理器上运行的端点,但在 localhost 上查找它:
来自 TM 2 上的 beam-worker-pool 的日志:
2021/08/11 09:43:16 Failed to obtain provisioning information: failed to dial server at localhost:33705
caused by:
context deadline exceeded
TM 1 上的提供端点实际上是在端口 33705 上侦听的端点,而它正在 localhost 上寻找它,因此无法连接到它。
编辑 3:展示我如何测试这个:
...............
TM 1:
========
$ kubectl logs my-first-flink-cluster-taskmanager-1-1 -c beam-worker-pool
2021/08/12 09:10:34 Starting worker pool 1: python -m apache_beam.runners.worker.worker_pool_main --service_port=50000 --container_executable=/opt/apache/beam/boot
Starting worker with command ['/opt/apache/beam/boot', '--id=1-1', '--logging_endpoint=localhost:33383', '--artifact_endpoint=localhost:43477', '--provision_endpoint=localhost:40983', '--control_endpoint=localhost:34793']
2021/08/12 09:13:05 Failed to obtain provisioning information: failed to dial server at localhost:40983
caused by:
context deadline exceeded
TM 2:
=========
$ kubectl logs my-first-flink-cluster-taskmanager-1-2 -c beam-worker-pool
2021/08/12 09:10:33 Starting worker pool 1: python -m apache_beam.runners.worker.worker_pool_main --service_port=50000 --container_executable=/opt/apache/beam/boot
Starting worker with command ['/opt/apache/beam/boot', '--id=1-1', '--logging_endpoint=localhost:40497', '--artifact_endpoint=localhost:36245', '--provision_endpoint=localhost:32907', '--control_endpoint=localhost:46083']
2021/08/12 09:13:09 Failed to obtain provisioning information: failed to dial server at localhost:32907
caused by:
context deadline exceeded
Testing:
.........................
TM 1:
============
$ kubectl exec -it my-first-flink-cluster-taskmanager-1-1 -c beam-worker-pool -- bash
root@my-first-flink-cluster-taskmanager-1-1:/# curl localhost:40983
curl: (7) Failed to connect to localhost port 40983: Connection refused
root@my-first-flink-cluster-taskmanager-1-1:/# curl localhost:32907
Warning: Binary output can mess up your terminal. Use "--output -" to ...
TM 2:
=============
root@my-first-flink-cluster-taskmanager-1-2:/# curl localhost:32907
curl: (7) Failed to connect to localhost port 32907: Connection refused
root@my-first-flink-cluster-taskmanager-1-2:/# curl localhost:40983
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
不知道如何解决这个问题。
谢谢, 戈尔扬
【问题讨论】:
-
澄清一下,当您使用 1 个任务管理器运行时,您仍然连接到外部环境的同一个端点,对吧?听起来两个任务管理器都试图在该端点创建外部环境(source code)引起了某种冲突,但我不确定这是由于已知限制、错误还是某种用户错误.
-
是的,@DanielOliveira - 使用一个任务管理器运行我使用相同的端点。我已经用有关配置的更多详细信息编辑了我的问题。
标签: apache-flink apache-beam tfx