我正在使用 spring kafka 消费者,它们包装在 Spring Boot 应用程序中,并作为微服务部署在关键的云类型转换厂中。我正在部署 15 个应用程序实例和 15 个 kafka 分区。由于这些实例大多数都是一一启动的,是否会进行多次重新平衡?在云中部署 kafka 消费者的推荐方法是什么?
最佳答案
新的0.11客户端有一个新属性group.initial.rebalance.delay.ms
see Notable changes in 0.11.0.0 .
A new config,
group.initial.rebalance.delay.ms
, was introduced. This config specifies the time, in milliseconds, that theGroupCoordinator
will delay the initial consumer rebalance. The rebalance will be further delayed by the value ofgroup.initial.rebalance.delay.ms
as new members join the group, up to a maximum ofmax.poll.interval.ms
. The default value for this is 3 seconds. During development and testing it might be desirable to set this to 0 inorder to not delay test execution time.
我们正在添加对 0.11 客户端的支持。目前计划发布 2.0 Spring for Apache Kafka 版本,但我们正在考虑发布 1.3 版本,其中包含 2.0 功能的子集以及对 0.11 的支持。
您可以尝试将新客户端与旧的 spring-kafka 一起使用;它可能有效,但当然,您不会获得 0.11 功能,例如交易和 Headers
。
关于java - 云中的 Kafka 消费者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45202097/