当我按键对数据进行分区,然后稍后在Kafka中将新分区添加到该主题时,会发生什么情况? [英] What happens when I partition data by key and then later on add a new partition to the topic in Kafka?

查看:42
本文介绍了当我按键对数据进行分区,然后稍后在Kafka中将新分区添加到该主题时,会发生什么情况?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我按键对数据进行分区,然后稍后在Kafka中向主题添加新分区时会发生什么?

What happens when I partition data by key and then later on add a new partition to the topic in Kafka?

现有记录是否会发生变化?以及未来的数据将如何划分?

Will there be any change to the existing record? And how will the future data be partitioned?

推荐答案

将新分区添加到特定主题后,现有数据的分区不会更改.Kafka不会尝试重新分发现有记录,并且此修改仅对新记录有效.请注意,默认情况下,Kafka使用 hash(key)%noOfPartitions 对数据进行分区,以确保将具有相同键的记录添加到同一分区.具有不同密钥的数据将以循环方式添加到分区中.

Partitioning of existing data doesn't change when new partitions are added to a particular topic. Kafka will not attempt to re-distribute existing records and this modification will only have effect on new records. Note that by default, Kafka partitions data using hash(key) % noOfPartitions in order to ensure that records with the same key are added to the same partition. Data with different key will be added to partitions in a round-robin fashion.

这篇关于当我按键对数据进行分区,然后稍后在Kafka中将新分区添加到该主题时,会发生什么情况?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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