Kafka默认topic最大长度(通过测试试出来的)

本文介绍了Kafka中关于主题和分区的一些限制条件,包括主题名称的最大长度为249个字符,分区数量不超过100,000个,以及文件夹名称的总长度不能超过255个字符等。同时提到了消息大小的默认限制为1MB,并提供了调整该设置的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1 参考官网描述信息

Each sharded partition log is placed into its own folder under the Kafka log directory. The name of such folders consists of the topic name, appended by a dash (-) and the partition id. Since a typical folder name can not be over 255 characters long, there will be a limitation on the length of topic names. We assume the number of partitions will not ever be above 100,000. Therefore, topic names cannot be longer than 249 characters. This leaves just enough room in the folder name for a dash and a potentially 5 digit long partition id.

每个分片的分区日志被放置到Kafka日志目录下自己的文件夹中。这些文件夹的名称由主题名(后面加一个破折号(-))和分区id组成。因为一个典型的文件夹名称不能超过255个字符,所以主题名称的长度会有限制。我们假设分区的数量永远不会超过100,000。因此,主题名称的长度不能超过249个字符。这就在文件夹名中留下了足够的空间,可以使用破折号和一个可能的5位长的分区id。

2 遇到问题

在这里插入图片描述
经过从10万到100之间的测试,发现最大支持250,超过则报错

3 消息限制大小 默认1M,可修改

在这里插入图片描述
参考:https://kafka.apache.org/documentation/#producerconfigs

修改步骤,下图为截图:
参考:https://my.oschina.net/objcoding/blog/3124509
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值