如何在单个 Kafka Streams 应用程序中连接到多个集群? [英] How to connect to multiple clusters in a single Kafka Streams application?

查看:57
本文介绍了如何在单个 Kafka Streams 应用程序中连接到多个集群?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Kafka Streams Developer指南它说:

Kafka Streams 应用程序只能与单个 Kafka 集群通信由该配置值指定.Kafka Streams 的未来版本将支持连接到不同的 Kafka 集群以读取输入流和写入输出流.

Kafka Streams applications can only communicate with a single Kafka cluster specified by this config value. Future versions of Kafka Streams will support connecting to different Kafka clusters for reading input streams and writing output streams.

这是否意味着我的整个应用程序只能连接到单个 Kafka Cluster 或 KafkaStreams 只能连接到一个集群?

Does this mean that my whole application can only connect to a single Kafka Cluster or each instance of KafkaStreams can only connect to a single cluster?

我是否可以创建多个具有不同属性的 KafkaStreams 实例来连接到不同的集群?

Could I create multiple KafkaStreams instances with different properties that connect to different clusters?

推荐答案

表示单个应用只能连接一个集群.

It means that a single application can only connect to one cluster.

  • 您无法从集群 A 读取主题并将计算结果写入集群 B.
  • 不可能使用同一个实例从两个不同的集群中读取两个主题.

我是否可以创建多个具有不同属性的 KafkaStreams 实例来连接到不同的集群?

Could I create multiple KafkaStreams instances with different properties that connect to different clusters?

是的,绝对.但是这些不同的实例将是不同的应用程序.(想想消费者群体".)

Yes, absolutely. But those different instances will be different applications. (Think "consumer groups".)

更新:

在单个 JVM 中,您可以创建任意数量的 KafkaStreams 实例.您还可以将它们配置为连接到不同的集群(如果您想进行相同的处理,您可以对所有集群使用相同的 KStreamBuilder).

Within a single JVM, you can create as many KafkaStreams instances as you like. You can also configure them to connect to different clusters (and you can use the same KStreamBuilder for all of them if you want to do the same processing).

这篇关于如何在单个 Kafka Streams 应用程序中连接到多个集群?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆