使用 helm 在 Kubernetes 中扩展 Kafka 流应用程序部署

Scaling up a Kafka streams application deployment in Kubernetes using helm

我们有一个基于 Java 的 kafka 流应用程序,它使用 helm 图表部署到 kubernetes 集群。为了扩大部署,我们使用副本集的 Kubernetes 选项,它将 运行 应用程序的多个实例。但是 运行 应用程序的多个实例不断使 pods 崩溃并出现以下错误。

Exception in thread "****-StreamThread-1" org.apache.kafka.common.errors.FencedInstanceIdException: The broker rejected this static consumer since another consumer with the same group.instance.id has registered with a different member.id.

您的配置中有太多是静态的。 根据文档:

group.instance.id
A unique identifier of the consumer instance provided by the end user. Only non-empty strings are permitted. If set, the consumer is treated as a static member, which means that only one instance with this ID is allowed in the consumer group at any time.

看起来您的应用程序的不同实例应该 不同 group.instance.id.

最后,它与 k8、helm 或任何东西都无关——你应该能够通过在本地计算机上启动应用程序的多个实例来复制它,所有实例都指向同一个 Kafka 安装。