How Partitions are split into Kafka Broker?

做~自己de王妃 提交于 2019-12-08 06:15:13

问题


I know that partitions are split across Kafka Broker. But the split is based on what ?. For instance, if I have 3 brokers and 6 partitions, how to ensure that each broker will have 2 partitions ? How this split is currently made in Kafka ?


回答1:


Assignment policy is an internal implementation detail and not documented as it can get changed at any point in time. Thus, you should not rely the this algorithms stay the same. Furthermore, there is nothing you can do to influent/configure this internal strategy.

The basic policy is to ensure load balancing, i.e., it assigns partitions to brokers that have less partitions assigned than other. Thus, for your example each broker will get 2 partitions assigned.

Furthermore, for partitions replicas a "rack aware" policy is applied (as of Kafka 0.10). That means that partition replicas are assigned to different racks if possible to guard again offline partitions if a whole rack fails. See this KIP for more details about this: https://cwiki.apache.org/confluence/display/KAFKA/KIP-36+Rack+aware+replica+assignment



来源:https://stackoverflow.com/questions/41532541/how-partitions-are-split-into-kafka-broker

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