从副本中消费 [英] Consuming from a replica

查看:59
本文介绍了从副本中消费的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Kafka将主题的每个分区复制到指定的复制因子.

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?

Kafka中的复制是否仅用于故障转移?

Is the replication in Kafka only for fail-over?

推荐答案

在Kafka 2.3及更低版本中,您只能从领导者那里消费-这是设计使然.复制仅用于容错.

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

如果领导者失败,则一名跟随者将被选为新的领导者.

If the leader fails, one of the follower will be elected as a new leader.

有关更多详细信息,请参阅此博客文章: http://www.confluent.io/blog/hands-free-kafka-replication-a-lesson-in-operational-simplicity/

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

更新:

从Kafka 2.4开始,可以从跟随者副本中进行抓取.有关详细信息,请查看KIP-392: https://cwiki.apache.org/confluence/display/KAFKA/KIP-392%3A+Allow+consumers+to+fetch+from+closest+replica

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

这篇关于从副本中消费的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆