代理在群集中关闭后会发生什么? [英] what happens after a broker is down in a cluster?

查看:47
本文介绍了代理在群集中关闭后会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设某个经纪人长期处于倒闭状态,那么该经纪人所包含的追随者和领导者会发生什么呢?

Suppose a broker is down for long time, now what happens to the followers and leaders that this broker was containing?

  • 如果代理包含一个领导者,并且选择了一个同步副本作为领导者,它是否会创建另一个同步副本(如果我们有特定的复制因子)?

  • if broker was containing a leader and one of in-sync replica is chosen as leader, does it create another in-sync replica(in case we have specific replication factor)?

如果代理包含跟随者,是否会在集群中的其他位置创建另一个跟随者?

if broker was containing a follower, does it create another follower elsewhere in cluster?

现在假设经纪人在很长一段时间后醒来,现在领导者和跟随者是否可以在其下跌时恢复原状?

now suppose broker awakens after long time, now do leaders and followers are restored as it left when it went down?

推荐答案

代理关闭时会发生什么情况取决于您的配置.它主要取决于以下配置设置:

What happens when a broker is down depends on your configuration. It mostly depends on these configuration settings:

  • min.insync.replicas
  • default.replication.factor
  • unclean.leader.election.enable

当代理发生故障时,Kafka不会创建新副本.

Kafka does not create a new replica when a broker goes down.

如果脱机代理是领导者,则将从同步副本中选出新的领导者.如果没有副本处于同步状态,则只有在 unclean.leader.election.enable 为true时,才会选择不同步的副本,否则分区将处于脱机状态.

If the offline broker was a leader, a new leader is elected from the replicas that are in-sync. If no replicas are in-sync it will only elect an out of sync replica if unclean.leader.election.enable is true, otherwise the partition will be offline.

如果离线经纪人是追随者,则领导者会将其标记为不同步.

If the offline broker was a follower, it will be marked a out of sync by the leader.

重新启动代理时,它将尝试恢复同步.完成后,是否保留跟随者还是成为领导者取决于它是否是首选的副本.

When restarting the broker, it will try to get back in sync. Once done, whether it stays a follower or becomes the leader depends if it is the prefered replica.

最后,如果您知道代理将长时间离线并且仍然需要副本,则可以使用重新分配工具 kafka-reassign-partitions.sh 将分区移至在线代理.

Finally if you know a broker will be offline for a long time and still require a replica, you can use the reassignment tool kafka-reassign-partitions.sh to move partitions to online brokers.

这篇关于代理在群集中关闭后会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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