首页 > 解决方案 > Kafka Post Deployment - 处理不断增长的客户

问题描述

我们已经为高可用性和分布式数据加载设置了一个 Kafka 集群。当前的消费者和生产者指定所有连接到集群的代理 IP 地址。将来,将需要持续监控集群并根据收集的指标和整体系统性能添加新的代理。万一代理崩溃,我们必须尽快添加一个具有不同 IP 的新代理。

在这些情况下,我们必须更改所有客户端配置,这是一项耗时且压力很大的操作。

我认为我们可以设置一个配置服务器(例如 Spring Cloud 配置服务器)以集中方式指定所有代理 IP 地址,因此我们必须在一个地方进行所有更改,而不涉及所有客户端,但我不知道是否这是最好的方法。显然,必须对客户端进行编程以从配置服务器获取代理列表。

有更好的方法吗?

标签: apache-kafka

解决方案


You could use a load balancer (with a friendly dns like kafka.domain.com), which points to all of your brokers. We do this in our environment. Your clients then connect to kafka.domain.com:9092.

As soon as you add new brokers, you only change the load balancer endpoints and not the client configuration.

Additionally please note that you only need to connect to one bootstrap broker and don't have to list all of them in the client configuration.


推荐阅读