简体   繁体   English

为什么Kafka分布式连接器在我创建它的节点被杀死时死亡?

[英]Why is the Kafka distributed connector dying when the node I created it on is killed?

I'm launching a Kafka connector in distributed mode in a local 'launch' Docker container (separate to the Kafka node container). 我在分布式模式下在本地“启动”Docker容器中启动Kafka连接器(与Kafka节点容器分开)。 The connector works as expected, but when I kill the launch container the connector stops working. 连接器按预期工作,但是当我杀死启动容器时,连接器停止工作。 I expected it to continue working since I believed it to be registered and running on a worker on the Kafka node in a different container. 我希望它继续工作,因为我相信它是在另一个容器中的Kafka节点上的一个工作者上注册和运行的。 My setup in more detail follows: 我的设置更详细如下:

Currently I'm running everything through Docker containers locally. 目前我在本地通过Docker容器运行所有内容。 I have: 我有:

  1. A Zookeeper node (3.4.9) Zookeeper节点(3.4.9)
  2. A Kafka node (Apache, 0.10.1.0) Kafka节点(Apache,0.10.1.0)
  3. A 'launch' node. 一个'发射'节点。

the launch node downloads the appropriate Kafka version and unzips it's contents. 启动节点下载相应的Kafka版本并解压缩其内容。 It then builds the connector source, sets the classpath to include the necessary JARs, then executes the connector as such: 然后构建连接器源,设置类路径以包含必要的JAR,然后执行连接器:

connect-distributed.sh config/connect-distributed.properties

The distributed properties file sets the group id, the various topic names, schemas and converters and also the bootstrap servers (which point to the Kafka node (2) above). 分布式属性文件设置组ID,各种主题名称,模式和转换器以及引导服务器(指向上面的Kafka节点(2))。

This command seems to execute properly, with the restful connector http service being started successfully. 此命令似乎正确执行,并且成功启动了restful连接器http服务。 I can then issue the POST request to http://example:8083/connectors , supplying the configuration for the connector tasks. 然后,我可以向http:// example:8083 / connectors发出POST请求,为连接器任务提供配置。 The command completes without error and the connector is successfully started. 该命令完成且没有错误,并且连接器已成功启动。 I can consume from a topic in the Kafka node (2) and I see output that indicates the connector is working and sending data through. 我可以从Kafka节点(2)中的主题消费,我看到输出,指示连接器正在工作并通过发送数据。

When I kill the launch node (3) I expect the connector to continue running since I registered it with the Kafka cluster, albeit a cluster of one. 当我杀死启动节点(3)时,我希望连接器继续运行,因为我在Kafka集群中注册了它,尽管它是一个集群。 The connector does not continue to run and appears to die with the launch node. 连接器不会继续运行,并且似乎与启动节点一起死亡。 Isn't the connector supposed to be managed now by a worker in the cluster? 群集中的工作人员现在不应该管理连接器吗? Do I need to change how I'm launching the connector or am I misunderstanding something? 我是否需要更改启动连接器的方式或者我是否误解了某些内容?

Kafka Connectors do not execute on the Kafka brokers. Kafka连接器不在Kafka代理上执行。 They are executed in "Kafka Connect Worker" processes, which is what your question is calling "a 'launch' node". 它们在“Kafka Connect Worker”进程中执行,这就是你的问题所谓的“启动'节点”。 These processes accept REST requests for connectors and run the connectors in the worker processes . 这些进程接受对连接器的REST请求,并在工作进程中运行连接器。 Under the hood, those processes are simply interacting with the Kafka brokers via normal producers and consumers. 在幕后,这些流程只是通过普通的生产者和消费者与Kafka经纪人进行交互。 Kafka Connect is providing a framework on top of those clients to make it easy to build scalable connectors so connector developers only need to focus on how to pull or push data to the system the connector is written for. Kafka Connect在这些客户端之上提供了一个框架,可以轻松构建可扩展的连接器,因此连接器开发人员只需关注如何将数据拉或推送到连接器所针对的系统。 This means that processing only continues if at least one worker process is still alive. 这意味着只有在至少一个工作进程仍处于活动状态时才继续处理。

There are two types of worker processes. 有两种类型的工作进程。 In standalone mode, the connector configuration is not persisted anywhere -- you generally pass it in via the command line. 在独立模式下,连接器配置不会在任何地方保留 - 您通常通过命令行传递它。 Offset information (ie which data you've already copied) is maintained on the local filesystem. 在本地文件系统上维护偏移信息(即您已经复制的数据)。 Therefore, in this mode, you can only assume you'll resume where you left off if you restart the process on the same node with access to the same filesystem. 因此,在此模式下,如果在可访问同一文件系统的同一节点上重新启动进程,则只能假设您将从中断处继续。

In distributed mode, the workers coordinate to distribute the work and they share common, persistent storage (in Kafka) for connector configs, offsets, etc. This means that if you start up one instance and create a connector, shutting down that instance will halt all work. 在分布式模式下,工作人员协调分配工作,并且他们共享连接器配置,偏移等的公共持久存储(在Kafka中)。这意味着如果启动一个实例并创建连接器,则关闭该实例将停止一切工作。 However, when you start an instance again, it will resume where it left off without re-submitting the connector configuration because that information has been persisted to Kafka. 但是,当您再次启动实例时,它将从中断处继续,而不重新提交连接器配置,因为该信息已持久保存到Kafka。 If you start multiple instances, they will coordinate to load balance the tasks between them, and if one instance fails (due to crash, elastically scaling down the # of instances you are running, power failure, etc), the remaining instances will redistribute the work automatically. 如果启动多个实例,它们将协调以平衡它们之间的任务,如果一个实例失败(由于崩溃,弹性缩小正在运行的实例数,电源故障等),其余实例将重新分配自动工作。

You can find more details about workers, the different types, and how failover works in distributed mode in Confluent's Kafka Connect documentation 您可以在Confluent的Kafka Connect文档中找到有关工作人员,不同类型以及故障转移如何在分布式模式下工作的更多详细信息

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

相关问题 第二个和第三个分布式 Kafka 连接器工作人员无法正常工作 - Second and Third Distributed Kafka Connector workers failing to work correctly 如何最好地将连接器添加到 docker compose 中的 kafka connect? - How can I best add connector to kafka connect in docker compose? 我的coreos / fleet部署的服务正在消亡,我不知道为什么 - my coreos/fleet deployed service is dying and I can't tell why 手动安装 Kafka 连接器 - Install Kafka connector manually 为什么在Docker容器中杀死一个进程时会杀死其他不相关的进程 - Why other unrelated processes are killed when one process is killed in docker container Debezium 如何使用 Kafka Connect 正确注册 SqlServer 连接器 - 连接被拒绝 - Debezium How do I correctly register the SqlServer connector with Kafka Connect - connection refused 为什么我应该使用 docker image "confluentinc/kafka" 到 kafka 集群? - why should i use docker image "confluentinc/kafka" to kafka cluster? 为什么我无法连接到 Kafka? - Why Can't I Connect to Kafka? 我需要创建一个已创建主题的 kafka 图像 - I need to create a kafka image with topics already created Kafka JDBC 接收器连接器未访问正确的连接器配置 - Kafka JDBC sink connector does not access the correct connector configurations
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM