简体   繁体   English

如果其副本中的一个副本停止以跟上复制因素,那么kafka会创建一个新的关注者

[英]Would kafka create a new follower if one of its replica is down to keep up with replication factor

Below is my partition information for the topic xx_json_topic .This is a Kafka cluster with three nodes . 下面是我的主题xx_json_topic的分区信息。这是一个有三个节点的Kafka集群。

All nodes up : 所有节点:

Topic: xx_json_topic    PartitionCount:4    ReplicationFactor:2    Configs:
Topic: xx_json_topic    Partition: 0    Leader: 1   Replicas: 3,1   Isr: 3,1
Topic: xx_json_topic    Partition: 1    Leader: 2   Replicas: 1,2   Isr: 2,1
Topic: xx_json_topic    Partition: 2    Leader: 2   Replicas: 2,3   Isr: 2,3
Topic: xx_json_topic    Partition: 3    Leader: 3   Replicas: 3,2   Isr: 2,3

At this point.. if i bring down the node "node-1" ..It looks like below : 此时..如果我关闭节点“node-1”..它看起来如下:

Topic: xx_json_topic    PartitionCount:4    ReplicationFactor:2    Configs:
Topic: xx_json_topic    Partition: 0    Leader: 3   Replicas: 3,1   Isr: 3
Topic: xx_json_topic    Partition: 1    Leader: 2   Replicas: 1,2   Isr: 2
Topic: xx_json_topic    Partition: 2    Leader: 2   Replicas: 2,3   Isr: 2,3
Topic: xx_json_topic    Partition: 3    Leader: 3   Replicas: 3,2   Isr: 2,3

My question is ..if kafka knows that the node-1 is down and it needs to maintain the replication factor ,wouldn't it make node 3 a replica for partition-1 && node-2 a replica for partition-0 then make node-3 and node-2 part of their Isr ? 我的问题是..如果kafka知道node-1已经关闭并且它需要维护复制因子,它不会使节点3成为partition-1的复制品而&node-2是一个replica for partition-0然后make节点他们的Isr的-3和node-2部分?

Or you think Kafka doesn't promise that... If replication factor is 2 ..It doesn't mean that data will be available in atleast 2 nodes at all time(---like consistency level in Cassandra) . 或者你认为Kafka不承诺...如果复制因子是2 ..这并不意味着数据将始终在至少2个节点中可用(---就像Cassandra中的一致性级别一样)。

You are correct that this is not the way replication factor is handled in Kafka. 你是对的,这不是Kafka处理复制因子的方式。 When you specify a replication factor of 2 for a topic, the partitions of that topic are created on 2 brokers (and the cluster controller attempts to spread them out over the cluster). 为主题指定复制因子2时,将在2个代理上创建该主题的分区(并且群集控制器会尝试将它们分散到群集上)。 At that time, one becomes the leader, and one becomes the follower. 那时,一个人成为领导者,一个人成为追随者。 This is not a guarantee that there will always be two copies of the partitions, it only specifies that two replicas are created, and the brokers will notify you (via the underreplicated partitions count mbean) if all replicas do not exist. 这并不能保证总会有两个分区副本,它只指定创建两个副本,如果所有副本都不存在,代理将通知您(通过重复不足的分区计数mbean)。

Kafka does not perform any automatic repair of the cluster, with the exception that if you have multiple replicas for a partition, and the leader replica becomes unavailable, one of the followers will take over as leader. Kafka不会对群集执行任何自动修复,但如果您有一个分区的多个副本,并且领导者副本变得不可用,则其中一个关注者将接管为领导者。 When that leader comes back, however, it will not resume leadership (it becomes a follower). 然而,当领导者回来时,它将不会恢复领导(它成为追随者)。 In the same way, the cluster will not create new replicas. 同样,群集不会创建新的副本。 This can be a very resource-intensive operation, as a lot of data needs to be moved across the network to the new replica. 这可能是一项资源密集型操作,因为需要将大量数据通过网络移动到新副本。

While there is an option to perform automatic leader rebalancing, there is no equivalent option to perform automatic replica creation. 虽然可以选择执行自动领导者重新平衡,但没有相同的选项来执行自动副本创建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM