Kafka制作人可以创建主题和分区吗? [英] Can a Kafka producer create topics and partitions?

查看:195
本文介绍了Kafka制作人可以创建主题和分区吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在评估不同的消息传递系统. 有一个与Apache Kafka有关的问题,我无法回答自己.

currently I am evaluating different Messaging Systems. There is a question related to Apache Kafka which I could not answer myself.

Kafka制作人是否可以动态创建主题和分区(以及现有主题)? 如果是,那么它是否有任何不利之处?

Is it possible for a Kafka producer to create topics and partitions (on existing topics aswell) dynamically? If yes, is there any disadvantage that comes with it?

预先感谢

推荐答案

已更新:

kafka经纪人具有以下财产: auto.create.topics.enable

The kafka broker has a property: auto.create.topics.enable

如果生产者将消息发布到具有新主题名称的主题,则将其设置为true,它将自动为您创建主题.

If you set that to true if the producer publishes a message to the topic with the new topic name it will automatically create a topic for you.

Confluent团队建议不要执行此操作,因为根据您的环境,爆炸的主题可能会变得笨拙,并且创建主题时将始终具有相同的默认值.重要的是,复制因子至少应为3,以确保磁盘发生故障时主题的持久性.

The Confluent Team recommends not doing this because the explosion of topics, depending on your environment can become unwieldy, and the topic creation will always have the same defaults when created. It's important to have a replication-factor of at least 3 to ensure durability of your topics in the event of disk failure.

这篇关于Kafka制作人可以创建主题和分区吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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