简体   繁体   English

GRPC 错误 Docker Mac - 使用 Python、Beam 和 Flink 进行 Kafka 流处理

[英]GRPC Error Docker Mac - Kafka Stream Processing with Python, Beam, and Flink

Update: I spun up an EC2 instance and was able to get the example below to work, which confirms that this is a connectivity issue with Docker on Mac.更新:我启动了一个 EC2 实例,并且能够使下面的示例工作,这证实这是 Mac 上 Docker 的连接问题。

Update: I still face this error even when I bring down the Flink Server Container and Kafka, which leads to believe this is a connectivity issue更新:即使我关闭了 Flink Server Container 和 Kafka,我仍然面临这个错误,这导致我相信这是一个连接问题

I recently tried processing a Kafka Stream with Python, Apache Beam, and Apache Flink using tutorial tutorial .我最近尝试使用教程教程使用 Python、Apache Beam 和 Apache Flink 处理 Kafka Stream。 Based on the tutorial, I setup Flink with the following command :根据教程,我使用以下命令设置 Flink

docker run --net=host apache/beam_flink1.13_job_server:latest

Doing so results in the following:这样做会导致以下结果:

Jul 14, 2021 8:40:47 PM org.apache.beam.runners.jobsubmission.JobServerDriver createArtifactStagingService
INFO: ArtifactStagingService started on localhost:8098
Jul 14, 2021 8:40:47 PM org.apache.beam.runners.jobsubmission.JobServerDriver createExpansionService
INFO: Java ExpansionService started on localhost:8097
Jul 14, 2021 8:40:47 PM org.apache.beam.runners.jobsubmission.JobServerDriver createJobServer
INFO: JobService started on localhost:8099
Jul 14, 2021 8:40:47 PM org.apache.beam.runners.jobsubmission.JobServerDriver run
INFO: Job server now running, terminate with Ctrl+C

When running my script with python main.py (shown below) I get the following error:使用python main.py (如下所示)运行我的脚本时,出现以下错误:

grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNAVAILABLE
        details = "failed to connect to all addresses"
        debug_error_string = "{"created":"@1626301362.091496000","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3009,"referenced_errors":[{"created":"@1626301362.091494000","description":"failed to connect to all addresses","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":398,"grpc_status":14}]}"

Does anyone know of a quick workaround for this?有没有人知道一个快速的解决方法? I should note I found this我应该注意到我发现了这个

main.py主文件

import apache_beam as beam
from apache_beam.io.kafka import ReadFromKafka
from apache_beam.options.pipeline_options import PipelineOptions

if __name__ == '__main__':
    options = PipelineOptions([
        "--runner=PortableRunner",
        "--job_endpoint=localhost:8099",
        "--environment_type=LOOPBACK",
    ])

    pipeline = beam.Pipeline(options=options)

    result = (
        pipeline
        | "Read from kafka" >> ReadFromKafka(
            consumer_config={
                "bootstrap.servers": 'localhost:9092',
            },
            topics=['demo'],
            expansion_service='localhost:8097',
        )

        | beam.Map(print)
    )

    pipeline.run()

Docker Desktop for Mac 不支持 --net=host

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM