简体   繁体   English

为kafka中基于正则表达式的主题指定默认分区和复制因子

[英]Specify default partitions and replication factor for regex based topics in kafka

Background: I have set default number of partitions=1 and replication factor=3 in my kafka server.properties file and have enabled topic creation. 背景:我在我的kafka server.properties文件中设置了默认的分区数= 1,复制因子= 3,并启用了主题创建。 Kafka cluster is running with both authentication and authorization. Kafka群集同时运行身份验证和授权。 There are topic for which I have given permissions to only one user for create,read,write and the permissions is based on a topic prefix like foo. 对于某些主题,我仅授予一个用户用于创建,读取,写入的权限,并且该权限基于像foo这样的主题前缀。 . This user has permissions to create and consumer from topics which start with foo. 该用户有权创建和使用以foo开头的主题。 Now, I want to create all the foo. 现在,我要创建所有的foo。 topics with default partition=3 and replication factor=6 (this is different from global default in server properties). 主题的默认分区为3,复制因子为6(这与服务器属性中的全局默认值不同)。 The topic creation is dynamic and the names are not known beforehand. 主题创建是动态的,名称事先未知。

Question: Is it possible to specify different default partitions and replication factor for topics of type foo.*? 问题:是否可以为foo。*类型的主题指定不同的默认分区和复制因子? If not what is the best way to achieve this from producer point of view? 如果不是,从生产者的角度来看,实现此目标的最佳方法是什么?

I know of KafkaAdmin utils but the topic creation will happen on producer and I don't want to give admin permissions on metadata stored in zookeeper to the user running the producer for security reasons. 我知道KafkaAdmin实用程序,但是主题创建将在生产者上进行,出于安​​全原因,我不想将存储在zookeeper中的元数据的管理员权限授予运行生产者的用户。

Thanks! 谢谢!

There is no such property like this. 没有这样的属性。 You would have to make some topic creation proxy thing to allow custom logic like this. 您将不得不做一些主题创建代理的事情来允许这样的自定义逻辑。

Or write a Kafka Improvement Proposal (KIP), and maybe the feature can be added ;) 或编写一个Kafka改进建议(KIP),也许可以添加该功能;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM