Partition/Repliac的重新分配过程
1、将Zookeeper中的AR(Current Assigend Replicas)更新为OAR (Original list of replicas for partition )+ RAR (Reassigned replicas)
2、强制更新Zookeeper中的leader epoch,向AR中的每个replica发送LeaderAndIsRequesrt
3、将PAR-OAR中的replica设置为NewReplica
4、等待直到RAR中所有的Replica都与其Leader同步
5、将RAR中所有的Replica都设置为OnlineReplica状态
6、将Cacha中的AR设置为RAR
7、若Leader不在RAR中,则将RAR中重新选举一个新的Leader并发送到LeaderAndIsRequest,若新的leader不是从RAR中选举而出,则还要增加Zookeeper中的leader epoch
8、将OAR-RAR中的所有Replica设置为OfflineReplica状态,该过程包含两部分:
(1)将Zookeeper上ISA中的OAR-RAR移除,并向Leader发送LeaderAndIsRequest从而通知这些replica已经从ISA中剔除
(2)向OAR-RAR中的Replica发送StopReplicaRequest从而停止不在分配给该Partition的replica
9、将OAR-RAR中的所有Replica设置为NonExistentReplica状态从而将其从磁盘上删除
10、将Zookeeper中的AR设置为RAR
11、删除/admin/reassign_partition
kafka之Partition/Repliac的重新分配过程(详解)
最新推荐文章于 2024-04-19 00:31:41 发布