我正在浏览 kafka
文档并遇到了
Guarantees
At a high-level, Kafka gives the following guarantees:
Messages sent by a producer to a particular topic partition will be appended in the order they are sent. That is, if a record M1 is sent by the same producer as a record M2, and M1 is sent first, then M1 will have a lower offset than M2 and appear earlier in the log. A consumer instance sees records in the order they are stored in the log. For a topic with replication factor N, we will tolerate up to N-1 server failures without losing any records committed to the log.
我有几个问题。
M1
的偏移量低于 M2
?如果 M1
晚于 M2
重试怎么办? 最佳答案
即使只有一个分区,一种可能的情况是:
M1
M2
M1
由于某些失败,在第一次尝试时没有被确认 M2
已发货 M1
在随后的尝试中交付。 避免这种情况的一种简单方法是通过生产者配置
max.in.flight.requests.per.connection=1
.这当然会影响性能,因此应谨慎使用。
关于apache-kafka - 卡夫卡排序保证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46127716/