Consuming from a replica

旧街凉风 提交于 2019-12-10 21:21:11

问题


Kafka replicates each partition of a topic up-to specified replication factor.

As far as I know, all write and read requests are routed to the leader of the partition. Is there any way to consume from the followers not from the leader?

Is the replication in Kafka only for fail-over?


回答1:


In Kafka 2.3 and older, you can only consume from the leader -- this is by design. Replication is for fault-tolerance only.

If leader fails, the followers will elect a new leader.

Have a look at this blog post for more details: http://www.confluent.io/blog/hands-free-kafka-replication-a-lesson-in-operational-simplicity/

Update:

As of Kafka 2.4, fetching from follower replicas is possible. For details, check out KIP-392: https://cwiki.apache.org/confluence/display/KAFKA/KIP-392%3A+Allow+consumers+to+fetch+from+closest+replica



来源:https://stackoverflow.com/questions/37803376/consuming-from-a-replica

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!